Interview Question

What is shadow DOM?

Shadow DOM helps a component keep its internal structure and styles separate.

💡 Concept ✅ Quick Revision 🌐 HTML

Answer

Shadow DOM is a private DOM area attached to an element. • Its internal styles can be kept separate from page styles. • It is commonly used inside Web Components. • The component can still expose safe parts for outside styling.

💡 Simple Example

<p>A `&lt;video&gt;` control bar is an easy example of browser-managed internal UI.</p>

⚡ Quick Revision

Shadow DOM helps a component keep its internal structure and styles separate.