CSSStyleDeclaration: cssText property - Web APIs | MDN

Value

A string containing the text of the element's inline style declaration.

Example

html

<span id="s1" style="color: red;">Some text</span>

js

const elem = document.getElementById("s1");
console.log(elem.style.cssText); // "color: red;"

Specifications

Specification
CSS Object Model (CSSOM)
# dom-cssstyledeclaration-csstext

Browser compatibility

Help improve MDN

Learn how to contribute

This page was last modified on by MDN contributors.