CSS :empty Pseudo-class
Example
Specify a salmon background color for empty elements with class="box":
box:empty
{
background-color:
salmon;
}
Try it Yourself »
Definition and Usage
The CSS :empty pseudo-class
matches every element that has no children (including text nodes).
Tip: An element has children if it contains another element, text or even white space in between its tags.
| Version: | CSS3 |
|---|
Browser Support
The numbers in the table specifies the first browser version that fully supports the pseudo-class.
| Pseudo-class | |||||
|---|---|---|---|---|---|
| :empty | 4.0 | 9.0 | 3.5 | 3.2 | 9.6 |
CSS Syntax