| CSS syntax (Case Insensitive) |
Javascript syntax (case sensitive) |
| Border |
Border |
| Border-bottom |
Borderbottom |
| Border-bottom-color |
Borderbottomcolor |
| Border-bottom-style |
Borderbottomstyle |
| Border-bottom-Width |
Borderbottomwidth |
| Border-color |
Bordercolor |
| Border-left |
Borderleft |
| Border-left-color |
Borderleftcolor |
| Border-left-style |
Borderleftstyle |
| Border-left-Width |
Borderleftwidth |
| Border-Right |
Borderright |
| Border-right-color |
Borderrightcolor |
| Border-right-style |
Borderrightstyle |
| Border-right-Width |
Borderrightwidth |
| Border-style |
Borderstyle |
| Border-top |
Bordertop |
| Border-top-color |
Bordertopcolor |
| Border-top-style |
Bordertopstyle |
| Border-top-Width |
Bordertopwidth |
| Border-Width |
Borderwidth |
| Clear |
Clear |
| Float |
Floatstyle |
| Margin |
Margin |
| Margin-bottom |
Marginbottom |
| Margin-left |
Marginleft |
| Margin-Right |
Marginright |
| Margin-top |
Margintop |
| Padding |
Padding |
| Padding-bottom |
Paddingbottom |
| Padding-left |
Paddingleft |
| Padding-Right |
Paddingright |
| Padding-top |
Paddingtop |
| |
| Comparison of color and background tags and attributes |
| CSS syntax (Case Insensitive) |
Javascript syntax (case sensitive) |
| Background |
Background |
| Background-Attachment |
Backgroundattachment |
| Background-color |
Backgroundcolor |
| Background-Image |
Backgroundimage |
| Background-Position |
Backgroundposition |
| Background-repeat |
Backgroundrepeat |
| Color |
Color |
| |
| Comparison between style labels and attributes |
| CSS syntax (Case Insensitive) |
Javascript syntax (case sensitive) |
| Display |
Display |
| List-style-type |
Liststyletype |
| List-style-Image |
Liststyleimage |
| List-style-Position |
Liststyleposition |
| List-style |
Liststyle |
| White-space |
Whitespace |
| |
| Text style label and attribute comparison |
| CSS syntax (Case Insensitive) |
Javascript syntax (case sensitive) |
| Font |
Font |
| Font-family |
Fontfamily |
| Font-size |
Fontsize |
| Font-style |
Fontstyle |
| Font-variant |
Fontvariant |
| Font-weight |
Fontweight |
| |
| Text tag and attribute comparison |
| CSS syntax (Case Insensitive) |
Javascript syntax (case sensitive) |
| Letter-spacing |
Letterspacing |
| Line-break |
Linebreak |
| Line-height |
Lineheight |
| Text-align |
Textalign |
| Text-Decoration |
Textdecoration |
| Text-indent |
Textindent |
| Text-justify |
Textjustify |
| Text-Transform |
Texttransform |
| Vertical-align |
Verticalalign |
Supplement:
In the process of website construction, it is inevitable that JavaScript will be used to control CSS. In fact, this is a very simple example.
HTML: <Div id = "my_div" style = "background-color: Red"> JavaScript control CSS </div>
JS: Document. getelementbyid ("my_div"). style. backgroundcolor = "red"
In fact, the style object is used to access CSS attributes. It is worth noting that style attributes are written in background-color in CSS, but backgroundcolor in Js, in general, "_" is removed, and the second letter is capitalized.
If you use an external style table, use the currentstyle object instead of the style object. For example:
Document. getelementbyid ("my_div"). currentstyle. backgroundcolor = "red"
Example:
<! Doctype HTML public "-// W3C // dtd xhtml 1.0 transitional // en" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<HTML xmlns = "http://www.w3.org/1999/xhtml">
<Head>
<Meta http-equiv = "Content-Type" content = "text/html; charset = UTF-8"/>
<Title> tested </title>
<SCRIPT type = "text/JavaScript">
Function divfloatright (e ){
E. style. backgroundcolor = "# ff0000 ";
E. style. stylefloat = "right"; // IE
E.style.css float = "right"; // Firefox and others Explorer
}
Function divfloatleft (e ){
E. style. backgroundcolor = "Transparent ";
E. style. stylefloat = "Left ";
E.style.css float = "Left ";
}
</SCRIPT>
</Head>
<Body>
<Div>
<Div id = "Demo" style = "border: dashed 1px #000000 ;"Onmousemove = "divfloatright (this );"
Onclick = "divfloatleft (this);">
Javascript controls the float attribute of Div, onmousemove ~ Float: Right, onclick ~ Float: left.
</Div>
</Div>
</Body>
</Html>