Class CSSRule
- Namespace
- CSharpToJavaScript.APIs.JS
- Assembly
- CSharpToJavaScript.dll
The CSSRule interface represents a single CSS rule. There are several types of rules which inherit properties from CSSRule.
[Value("CSSRule")]
public class CSSRule
- Inheritance
-
CSSRule
- Derived
- Inherited Members
Remarks
Constructors
CSSRule()
public CSSRule()
Fields
CHARSET_RULE
[Value("CHARSET_RULE")]
public const ushort CHARSET_RULE = 2
Field Value
COUNTER_STYLE_RULE
[Value("COUNTER_STYLE_RULE")]
public const ushort COUNTER_STYLE_RULE = 11
Field Value
FONT_FACE_RULE
[Value("FONT_FACE_RULE")]
public const ushort FONT_FACE_RULE = 5
Field Value
FONT_FEATURE_VALUES_RULE
[Value("FONT_FEATURE_VALUES_RULE")]
public const ushort FONT_FEATURE_VALUES_RULE = 14
Field Value
IMPORT_RULE
[Value("IMPORT_RULE")]
public const ushort IMPORT_RULE = 3
Field Value
KEYFRAMES_RULE
[Value("KEYFRAMES_RULE")]
public const ushort KEYFRAMES_RULE = 7
Field Value
KEYFRAME_RULE
[Value("KEYFRAME_RULE")]
public const ushort KEYFRAME_RULE = 8
Field Value
MARGIN_RULE
[Value("MARGIN_RULE")]
public const ushort MARGIN_RULE = 9
Field Value
MEDIA_RULE
[Value("MEDIA_RULE")]
public const ushort MEDIA_RULE = 4
Field Value
NAMESPACE_RULE
[Value("NAMESPACE_RULE")]
public const ushort NAMESPACE_RULE = 10
Field Value
PAGE_RULE
[Value("PAGE_RULE")]
public const ushort PAGE_RULE = 6
Field Value
STYLE_RULE
[Value("STYLE_RULE")]
public const ushort STYLE_RULE = 1
Field Value
SUPPORTS_RULE
[Value("SUPPORTS_RULE")]
public const ushort SUPPORTS_RULE = 12
Field Value
Properties
CssText
The cssText property of the CSSRule
interface returns the actual text of a CSSStyleSheet style-rule.
[Value("cssText")]
public string CssText { get; set; }
Property Value
- string
A string containing the actual text of the CSSStyleSheet rule.
Remarks
NOTE
Do not confuse this property with element-style
CssText.
Be aware that this property used to be mutable but is now read-only. Attempting to
set it does absolutely nothing, and doesn't even emit a warning or error.
Furthermore, it has no settable sub-properties. Therefore, to modify it, use the
stylesheet's {{domxref("CSSRuleList", "cssRules[index]")}} properties
SelectorText and
Style (or its sub-properties). See Using dynamic styling information for details.
ParentRule
The parentRule property of the CSSRule
interface returns the containing rule of the current rule if this exists, or otherwise
returns null.
[Value("parentRule")]
public CSSRule? ParentRule { get; }
Property Value
- CSSRule
A CSSRule which is the type of the containing rules. If the current rule is inside a media query, this would return CSSMediaRule. Otherwise it returns null.
Remarks
ParentStyleSheet
The parentStyleSheet property of the
CSSRule interface returns the StyleSheet object in which
the current rule is defined.
[Value("parentStyleSheet")]
public CSSStyleSheet? ParentStyleSheet { get; }
Property Value
- CSSStyleSheet
A StyleSheet object.
Remarks
Type
IMPORTANT
Deprecatedtype property of theCSSRule interface is a deprecated property that returns an integer
indicating which type of rule the CSSRule represents.
[Value("type")]
public ushort Type { get; }
Property Value
- ushort
The values
CSSRule.UNKNOWN_RULE(0),CSSRule.CHARSET_RULE(2),CSSRule.DOCUMENT_RULE(13),CSSRule.VIEWPORT_RULE(14), andCSSRule.REGION_STYLE_RULE(16) cannot be obtained anymore.
Remarks
If you need to distinguish different types of CSS rule, a good alternative is to use constructor.name: