Free Trial

Safari Books Online is a digital library providing on-demand subscription access to thousands of learning resources.


  • Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • PrintPrint
Share this Page URL
Help

25. Client-Side JavaScript Reference > CSS2Properties: a set of CSS attributes ...

Name

CSS2Properties: a set of CSS attributes and their values — DOM Level 2 CSS2: Object → CSS2Properties

Properties

String cssText

The textual representation of a set of style attributes and their values. The text is formated as in a CSS stylesheet, minus the element selector and the curly braces that surround the attributes and values. Setting this property to an illegal value throws a DOMException with a code of SYNTAX_ERR. Attempting to set this property when the CSS2Properties object is read-only throws a DOMException with a code of NO_MODIFICATION_ALLOWED_ERR.

In addition to the cssText property, a CSS2Properties object also has a property corresponding to each CSS attribute that the browser supports. These property names correspond closely to the CSS attribute names, with minor changes required to avoid syntax errors in JavaScript. Multiword attributes that contain hyphens, such as “font-family”, are written without hyphens in JavaScript, and each word after the first is capitalized: fontFamily. Also, the “float” attribute conflicts with the reserved word float, so it translates to the property cssFloat.


  

You are currently reading a PREVIEW of this book.

                                                                                                                    

Get instant access to over $1 million worth of books and videos.

  

Start a Free 10-Day Trial


  
  • Safari Books Online
  • Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • PrintPrint