pseudo-element
::part() — CSS reference
Targets an exposed named part in a shadow tree. Internal elements must declare a matching part token; nested components require deliberate forwarding with exportparts. This is a component styling API, not unrestricted traversal of the shadow tree.
Formal Syntax & Structure
css syntaxcss
component::part(label) { color: teal; }Working Example
Example Snippetcss
<!doctype html><html lang="en"><meta charset="utf-8"><title>CSS reference lab</title><style>#a::part(label) {color:#006050}</style><body><div id="a" class="featured"><span id="slot" class="label">Assigned text <b id="nested">nested</b></span></div><div id="b">Outside</div><script>const root=a.attachShadow({mode:"open"});root.innerHTML="<style></style><p id=\"inside\" part=\"label\">Public</p><p id=\"private\">Private</p>";</script></body></html>