Get to know MDN better
This feature is well established and works across many devices and browser versions. It’s been available across browsers since July 2015.
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.
| CSS Object Model (CSSOM) # dom-cssrule-csstext |
Enable JavaScript to view this browser compatibility table.
This page was last modified on Jun 10, 2025 by MDN contributors.
Your blueprint for a better internet.
Visit Mozilla Corporation’s not-for-profit parent, the Mozilla Foundation.
Portions of this content are ©1998–2026 by individual mozilla.org contributors. Content available under a Creative Commons license.