files/en-us/web/api/cssvalue/csstext/index.md
{{APIRef("CSSOM")}}{{Deprecated_header}}
The cssText property of the {{domxref("CSSValue")}}
interface represents the current computed CSS property value.
[!NOTE] This property was part of an attempt to create a typed CSS Object Model. This attempt has been abandoned, and most browsers do not implement it.
To achieve your purpose, you can use:
- the untyped CSS Object Model, widely supported, or
- the modern CSS Typed Object Model API, less supported and considered experimental.
A string representing the current CSS property value.
const styleDeclaration = document.styleSheets[0].cssRules[0].style;
const cssValue = styleDeclaration.getPropertyCSSValue("color");
console.log(cssValue.cssText);
This feature was originally defined in the DOM Style Level 2 specification, but has been dropped from any standardization effort since then.
It has been superseded by a modern, but incompatible, CSS Typed Object Model API that is now on the standard track.
{{Compat}}