Private archive copy · Unofficial site · Content copyright belongs to Runoob Tutorial and the original authors · View Original

CSS3 :empty selector

CSS3 :empty selector

Complete CSS SelectorComplete CSS Selector Reference Manual

Example

Specify the background color of empty p elements:

p

:empty

{

background:

#ff0000

;

}

Try it »


Definition and Usage

:empty selector selects every element that has no children at all (including text nodes).


Browser support

The numbers in the table indicate the first browser version that supports this property.

Selector
:empty 4.0 9.0 3.5 3.2 9.6

Complete CSS SelectorComplete CSS Selector Reference Manual