XML DOM CSS2Properties Object
- Previous Page DOM CharacterData
- Next Page DOM CSSRule
The CSS2Properties object is a collection of all CSS2 properties and their values.
Description of CSS2Properties object
The CSS2Properties object represents a set of CSS style properties and their values. It defines a JavaScript property for each CSS property defined by the CSS specification.
The style property of an HTMLElement is a readable and writable CSS2Properties object, similar to the style property of a CSSStyleRule object. However, the return value of Window.getComputedStyle() is a CSS2Properties object whose properties are read-only.
CSS2Properties object properties
cssText property
The cssText property is a text representation of a set of style properties and their values. This text is formatted as a CSS stylesheet, with the curly braces around the element selectors and their properties removed.
Setting this property to an illegal value will throw an error with the code SYNTAX_ERR. DOMException ExceptionWhen the CSS2Properties object is read-only, attempting to set this property will throw an error with the code NO_MODIFICATION_ALLOWED_ERR. DOMException Exception.
Properties corresponding to CSS properties
In addition to the cssText property, the CSS2Properties object has a property for each CSS property supported by the browser. These property names closely correspond to the CSS property names, but some changes have been made to avoid syntax errors in JavaScript. Multi-word properties containing hyphens (such as font-family) do not have hyphens in JavaScript, but the first letter of each word is capitalized (such as fontFamily). In addition, the float property conflicts with the reserved word float, so it is converted to cssFloat.
and the CSS2Properties property names corresponding to each attribute defined by the CSS2 specification are style object reference manuallisted. Please note that some browsers may not support all CSS properties and may not support all the properties listed. Since these properties directly correspond to CSS properties, you can also refer to the CodeW3C.com provided CSS Reference Manual, to view their meanings and valid values.
- Previous Page DOM CharacterData
- Next Page DOM CSSRule