CSSRule : Object

Defines a CSS rule in a CSS style sheet.

Browser/User Agent Support

IEMozillaNetscapeOperaSafariNetscapte
6.0+1.0+no9.0+1.0+no

Constructors

ConstructorIEMozillaNetscapeOperaSafariNetscapte
Defines a CSS rule in a CSS style sheet.
6.0+1.0+no9.0+1.0+no
 

Properties

PropertyIEMozillaNetscapeOperaSafariNetscapte
Text for the current CSS rule.
6.0+1.0+no9.0+1.0+no
 
Parent rule for the current CSS rule.
6.0+1.0+no9.0+1.0+no
 
CSS style sheet that contains the rule.
no1.0+no9.0+1.0+no
 
Type of CSS rule.
no1.0+no9.0+1.0+no
 

References

CSSStyleRule

Availability

HTML DOM Level 2 | W3C

Constructor Detail

CSSRule CSSRule()

Defines a CSS rule in a CSS style sheet.

Visibility
internal

Property Detail

String cssText - read only

Text for the current CSS rule.

For examples, see the quirksmode test page:

http://www.quirksmode.org/dom/tests/stylesheets.html

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

CSSRule parentRule - read only

Parent rule for the current CSS rule.

Availability

HTML DOM Level 2 | W3C

CSSStyleSheet parentStyleSheet - read only

CSS style sheet that contains the rule.

For examples, see the quirksmode test page:

http://www.quirksmode.org/dom/tests/stylesheets.html

Availability

HTML DOM Level 2 | W3C

Number type - read only

Type of CSS rule.

Availability

HTML DOM Level 2 | W3C