Loading components…

Same selector, separate Shadow DOM trees

Both components use the exact selector :host h1. Each stylesheet sets a different color, and each rule can reach only its own shadow tree.

This page heading is styled by a global h1 rule. It does not color either component heading.

Single HTML file

The template, scoped style, and classic script live together in one .html file.

Separate HTML, CSS, and JavaScript

The template stays in HTML. A stylesheet link inside the template is cloned into the shadow root.

Accessibility and language