CSS :defined Pseudo-class
- Previous Page :default
- Next Page :dir()
- Go to the Previous Level CSS Pseudo-class Reference Manual
Definition and Usage
CSS :defined
Pseudo-classes are used to match any defined elements.
This pseudo-class can be used for standard elements and custom elements that have been successfully defined.
Example
Usage :defined
Pseudo-classes:
custom-element:not(:defined) { border-color: grey; color: grey; } custom-element:defined { background-color: salmon; border-color: maroon; color: black; } /* Display loading message */ custom-element:not(:defined)::before { content: "Loading..."; position: absolute; inset: 0 0 0 0; align-content: center; text-align: center; font-size: 25px; background-color: white; } /* Remove loading message */ custom-element:defined::before { content: ""; }
CSS Syntax
:defined { css declarations; }
Technical Details
Version: | CSS4 |
---|
Browser Support
The numbers in the table specify the first browser version that fully supports this pseudo-class.
Chrome | Edge | Firefox | Safari | Opera |
---|---|---|---|---|
54 | 79 | 63 | 10 | 41 |
- Previous Page :default
- Next Page :dir()
- Go to the Previous Level CSS Pseudo-class Reference Manual