Huoshi Website: CSS attributes and JavaScript encoding table

Source: Internet
Author: User

  DocumentCSS and JS work closely together to add a lot of unique effects to our pages. To achieve some special effect, we need to use Javascript to dynamically change the CSS attribute of a tag.

For example, when the mouse goes through an image, we add a border to the image. The code may be like this: what is the attribute behind the style in JavaScript?

<Script type = "text/javascript">
Function imageOver (e ){
E. style. border = "1px solid red ";
}
Function imageOut (e ){
E. style. borderWidth = 0;
}
</Script>

JavaScript CSS Style Attribute Table

Comparison between box labels and attributes

CSS syntax (Case Insensitive) JavaScript syntax (case sensitive)
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
Float floatStyle
Margin
Margin-bottom marginBottom
Margin-left marginLeft
Margin-right marginRight
Margin-top marginTop
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-attachment backgroundAttachment
Background-color backgroundColor
Background-image backgroundImage
Background-position backgroundPosition
Background-repeat backgroundRepeat
Color
Comparison between style labels and attributes
CSS syntax (Case Insensitive) JavaScript syntax (case sensitive)
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-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

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.