25.49. CSS2Properties: a set of CSS attributes and their valuesDOM Level 2 CSS2: Object CSS2Properties25.49.1. Properties
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 CSS reference, such as Cascading Style Sheets: The Definitive Guide by Eric A. Meyer (O'Reilly), for the meaning and legal values of each. All of the properties are strings. Setting any of these properties may throw the same exceptions as setting the cssText property:
25.49.2. DescriptionA CSS2Properties object represents a set of CSS style attributes and their values. It defines one JavaScript property for each CSS attribute defined by the CSS2 specification. The style property of an HTMLElement is a read/write CSS2Properties object, as is the style property of a CSSRule object. The return value of Window.getComputedStyle( ), however, is a CSS2Properties object whose properties are read-only. 25.49.3. See AlsoCSSRule, HTMLElement, Window.getComputedStyle( ); Chapter 16 |