Browser/User Agent Support
| IE | Mozilla | Netscape | Opera | Safari | Netscapte | no | 1.0+ | no | 9.0+ | 1.0+ | no |
|---|
Constructors
| Constructor | IE | Mozilla | Netscape | Opera | Safari | Netscapte |
|---|---|---|---|---|---|---|
CSS style declaration block consisting of CSS attributes and their values. | no | 1.0+ | no | 9.0+ | 1.0+ | no |
Properties
| Property | IE | Mozilla | Netscape | Opera | Safari | Netscapte |
|---|---|---|---|---|---|---|
Text for the current CSS rule. | no | 1.0+ | no | 9.0+ | 1.0+ | no |
Number of CSS style attributes in the style declaration block. | no | 1.0+ | no | 9.0+ | 1.0+ | no |
CSSRule that contains the CSSStyleDeclaration. | no | 1.0+ | no | 9.0+ | 1.0+ | no |
Methods
| Method | IE | Mozilla | Netscape | Opera | Safari | Netscapte |
|---|---|---|---|---|---|---|
Returns a CSS attribute value as an object. | no | 1.0+ | no | no | no | no |
Returns the priority of a CSS attribute. | no | 1.0+ | no | 9.0+ | 1.0+ | no |
Returns a CSS attribute value as a string. | no | 1.0+ | no | 9.0+ | 1.0+ | no |
Returns the name of the CSS attribute at the specified position. | no | 1.0+ | no | 9.0+ | 1.0+ | no |
Removes the specified CSS attribute from the CSS style declaration block. | no | 1.0+ | no | 9.0+ | 1.0+ | no |
Sets the value for a CSS attribute for a CSS style declaration block. | no | 1.0+ | no | 9.0+ | 1.0+ | no |
References
Availability
HTML DOM Level 2 | W3C
Constructor Detail
CSSStyleDeclaration CSSStyleDeclaration()
CSS style declaration block consisting of CSS attributes and their values.
- Visibility
- internal
Property Detail
String cssText
Text for the current CSS rule.
-
For examples, see the quirksmode test page:
- Remarks
-
If you specify an invalid value for
cssText, the property may throw one of the following DOMExceptions:HIERARCHY_REQUEST_ERR- CSS rule is not legal in the current location in the CSS style sheet.INVALID_MODIFICATION_ERR- New value for the CSS rule is for a different type than the previous type.NO_MODIFICATION_ALLOWED_ERR- The CSS rule or its parent CSS style sheet is read-only.SYNTAX_ERR- CSS syntax error.
- Availability
HTML DOM Level 2 | W3C
Number length - read only
Number of CSS style attributes in the style declaration block.
- Availability
HTML DOM Level 2 | W3C
CSSRule parentRule - read only
CSSRule that contains the CSSStyleDeclaration.
- Availability
HTML DOM Level 2 | W3C
Method Detail
getPropertyCSSValue(String propertyName) : static CSSValue
Returns a CSS attribute value as an object.
| String | propertyName | Name of the CSS attribute to return the CSS value for. |
- Availability
HTML DOM Level 2 | W3C
getPropertyPriority(String propertyName) : static String
Returns the priority of a CSS attribute.
| String | propertyName | Name of the CSS attribute to return the priority value for. |
-
For examples, see the quirksmode test page:
- Availability
HTML DOM Level 2 | W3C
getPropertyValue(String propertyName) : static String
Returns a CSS attribute value as a string.
| String | propertyName | Name of the CSS attribute to return the value for. |
-
For examples, see the quirksmode test page:
- Availability
HTML DOM Level 2 | W3C
item(Number index) : static String
Returns the name of the CSS attribute at the specified position.
| Number | index | Position of the CSS attribute to retrieve. |
-
For examples, see the quirksmode test page:
- Availability
HTML DOM Level 2 | W3C
removeProperty(String propertyName) : static String
Removes the specified CSS attribute from the CSS style declaration block.
| String | propertyName | Name of the CSS attribute to delete. |
-
For examples, see the quirksmode test page:
- Availability
HTML DOM Level 2 | W3C
setProperty(String propertyName, String value, String priority) : void
Sets the value for a CSS attribute for a CSS style declaration block.
| String | propertyName | Name of the CSS attribute to set. |
| String | value | Value for the CSS attribute. |
| String | priority | Priority for the CSS attribute. Specify either the string "important" or an empty string. |
-
For examples, see the quirksmode test page:
- Availability
HTML DOM Level 2 | W3C
