MDN self-hosted library · e01.org

HTMLStyleElement: sheet property

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

html
<style id="inline-style">
  p {
    color: blue;
  }
</style>
js
const style = document.getElementById("inline-style");
console.log(style.sheet.cssRules[0].cssText); // 'p { color: blue; }'