<div id="shadowRoot"></div>
<p>Light DOM</p>
p {
color: blue !important;
}
const elemnt = document.getElementById("shadowRoot");
const shadowRoot = elemnt.attachShadow({ mode: "closed" });
shadowRoot.innerHTML = `
<style>
p {
color: red;
text-transform: uppercase;
}
</style>
<p>Shadow DOM</p>
`;
This Pen doesn't use any external CSS resources.
This Pen doesn't use any external JavaScript resources.