What is Shadow DOM?

DefinitionShadow DOM is a web standard that lets a component attach its own hidden DOM tree to an element, keeping the component's markup and styles separate from the rest of the page so they do not clash.

A shadow root is attached to a host element with JavaScript or declared directly in HTML with declarative shadow DOM. Styles inside it apply only to its contents, and styles from the page do not leak in, apart from inherited properties, CSS custom properties and any parts the component chooses to expose. Slots let the page pass its own content into specific places inside the component.

Shadow DOM is one of the core technologies of Web Components, alongside custom elements and HTML templates, and browsers have long used it internally for built-in controls such as video players and form inputs. It prevents CSS conflicts in large sites and design systems, but it needs care with accessibility, forms and server-side rendering, since content inside shadow roots behaves differently from the regular DOM.

Shadow DOM resources

Topic: Web development

Cite this definition
APA

What is Shadow DOM? (2026, November 22). Glossary. https://glossary.io/shadow-dom/

MLA

“What Is Shadow DOM?” Glossary, Coywolf, 22 Nov. 2026, glossary.io/shadow-dom/.

Chicago

“What Is Shadow DOM?” Glossary. Coywolf. November 22, 2026. https://glossary.io/shadow-dom/.

HTML link
<a href="https://glossary.io/shadow-dom/">What is Shadow DOM?</a>

Published