Skip to main content

CSSRule

The CSSRule interface represents a single CSS rule. There are several types of rules which inherit properties from CSSRule.

MDN Reference

Properties

CHARSET_RULE

readonly CHARSET_RULE: 2;

COUNTER_STYLE_RULE

readonly COUNTER_STYLE_RULE: 11;

cssText

cssText: string;

The cssText property of the CSSRule interface returns the actual text of a CSSStyleSheet style-rule.

MDN Reference


FONT_FACE_RULE

readonly FONT_FACE_RULE: 5;

FONT_FEATURE_VALUES_RULE

readonly FONT_FEATURE_VALUES_RULE: 14;

IMPORT_RULE

readonly IMPORT_RULE: 3;

KEYFRAME_RULE

readonly KEYFRAME_RULE: 8;

KEYFRAMES_RULE

readonly KEYFRAMES_RULE: 7;

MARGIN_RULE

readonly MARGIN_RULE: 9;

MEDIA_RULE

readonly MEDIA_RULE: 4;

NAMESPACE_RULE

readonly NAMESPACE_RULE: 10;

PAGE_RULE

readonly PAGE_RULE: 6;

parentRule

readonly parentRule: CSSRule | null;

The parentRule property of the CSSRule interface returns the containing rule of the current rule if this exists, or otherwise returns null.

MDN Reference


parentStyleSheet

readonly parentStyleSheet: CSSStyleSheet | null;

The parentStyleSheet property of the CSSRule interface returns the StyleSheet object in which the current rule is defined.

MDN Reference


STYLE_RULE

readonly STYLE_RULE: 1;

SUPPORTS_RULE

readonly SUPPORTS_RULE: 12;

type

readonly type: number;

The read-only type property of the CSSRule interface is a deprecated property that returns an integer indicating which type of rule the CSSRule represents.

Deprecated

MDN Reference