TAG
JavaScript
Result
Run
License
<h1>I am adoptedStyleSheet property.</h1>
window.addEventListener("load", function() { const sheet = new CSSStyleSheet(); sheet.replaceSync("h1 { color: white; }"); document.adoptedStyleSheets = [sheet]; const sheet2 = new CSSStyleSheet(); sheet2.replaceSync("h1 { background-color: skyblue; }"); document.adoptedStyleSheets = [...document.adoptedStyleSheets, sheet2]; sheet.insertRule("h1 { font-style: italic; }"); });
Console
expand_less
License
License
by DevDic
Close