HTML and CSS Reference
In-Depth Information
Name
:empty
Applies to:
Any element
Description:
Matches elements that have no child nodes; that is, no child elements orcontent nodes. Con-
tent nodes are defined as any text, whitespace, entity reference, or CDATA nodes. Thus, <p>
</p> is notempty; nor is the element empty if the space is replaced with a newline. Note that
this pseudo-class does notapply to empty elements such as br , img , input , and so on.
Examples:
p:empty {padding: 1em; background: red;}
li:empty {display: none;}
Search WWH ::




Custom Search