Baseline Widely available
The cssText
property of the CSSRule
interface returns the actual text of a CSSStyleSheet
style-rule.
Note: Do not confuse this property with element-style CSSStyleDeclaration.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 cssRules[index]
properties .selectorText
and .style
(or its sub-properties). See Using dynamic styling information for details.
A string containing the actual text of the CSSStyleSheet
rule.
body {
background-color: darkblue;
}
let stylesheet = document.styleSheets[0];
console.log(stylesheet.cssRules[0].cssText); // body { background-color: darkblue; }
Specifications Browser compatibility
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4