pseudo-class
:defined — CSS reference
Matches elements defined by the document language or registered as custom elements. An unresolved custom element does not match until registration; styling alone does not register it.
Formal Syntax & Structure
css syntaxcss
:definedWorking Example
Example Snippetcss
<!doctype html><html lang="en"><meta charset="utf-8"><title>CSS reference lab</title><style>demo-ready, demo-pending {color:#202020} :defined {--defined: yes} demo-ready:defined {color:#006050}</style><body><demo-ready id="a">Ready</demo-ready><demo-pending id="b">Pending</demo-pending><script>customElements.define("demo-ready",class extends HTMLElement {});</script></body></html>