Source Code:
(back to article)
Submit
Result:
Report an issue
<body> <div id="my-element"></div> <script> // Creating Shadow DOM const shadowRoot = document.getElementById('my-element').attachShadow({ mode: 'open' }); // Styling Shadow DOM shadowRoot.innerHTML = ` <p>A simple shadow root content.</p> `; </script> </body>