CSS :empty Selector

❮ Previous Selectors Next ❯

Example

.example:empty {
  background: red;
}

Meaning

The :empty selector selects an element that has no children.

Children can be either element nodes or text (including whitespace).

Note: Comments, processing instructions, and CSS content do not affect whether an element is considered empty.

Version: CSS3




Standard Syntax

:empty {
  css declarations;
}



Browser Support

The numbers in the table specify the first browser version that fully supports the property.




Status







❮ Previous Selectors Next ❯