Home > Web Front-end > JS Tutorial > body text

Code to set css properties through javascript_javascript tips

WBOY
Release: 2016-05-16 18:37:53
Original
1151 people have browsed it

1. Transparency:
If a background color or a background image is not specified for a text, then the background of this element is usually transparent.
This is very important. If an absolutely positioned element with text is placed on top of an element with text, it will be very confusing. Then we can cover it by setting a background image or background color. , if necessary, we can set its display to "transparent" (transparent)
The general css for setting transparent elements is as follows:

Copy code The code is as follows:

opacity:.75;//ff new
-moz-opacity:.75;// transparency for older Mozillas
filter :Alpha(opacity=75);//for IE

2. CSS with hyphens:
Camel style naming:
Copy code The code is as follows:

element.style.fontFamily = "sans-serif";
element.style. borderLeftWidth = "5px";
element.style.zIndex = 100;

3. Things to note:
Copy code The code is as follows:

var padding_left = 50;
element.style.left = padding_left "px";//Don’t forget to add Unit
var topMargin = 10,rigntMargin = 11,bottomMargin = 12,leftMargin = 13;
element.style.margin = topMargin "px" rigntMargin "px" bottomMargin "px" leftMargin "px";

4. Set float
Copy code The code is as follows:

element.style.cssFloat = "left";//firefox chrome opera
element.style.styleFloat = "left";//IE
Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template