MDN self-hosted library · e01.org

CSSStyleDeclaration: cssText property

Runnable notebook: every JavaScript, HTML and CSS example on this page executes in a sandboxed local frame. Nothing leaves the browser.

html
<span id="s1" style="color: red;">Some text</span>
js
const elem = document.getElementById("s1");
console.log(elem.style.cssText); // "color: red;"