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.

The CSS2Properties property names corresponding to each attribute defined by the CSS2 specification are listed in the following table. Note, however, that some browsers do not support all CSS attributes and may not implement all of the listed properties. Since the properties correspond directly to CSS attributes, no individual documentation is given for each property. See a ...

Get JavaScript: The Definitive Guide, 5th Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.