Back to Content

CSSValue: cssText property

files/en-us/web/api/cssvalue/csstext/index.md

latest1.3 KB
Original Source

{{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:

Value

A string representing the current CSS property value.

Examples

js
const styleDeclaration = document.styleSheets[0].cssRules[0].style;
const cssValue = styleDeclaration.getPropertyCSSValue("color");
console.log(cssValue.cssText);

Specifications

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.

Browser compatibility

{{Compat}}

See also

  • {{domxref("CSSStyleDeclaration.getPropertyCSSValue()")}}