The empty pseudo-class
The empty pseudo-class specifies how
an empty element (containing no text) will
look like.
Syntax
cssselector:empty {
}
Example
In this example, the last li is empty,
but will still have a marker:
html<ul>
<li>list item</li>
<li>list item</li>
<li>list item</li>
<li>list item</li>
<li></li>
</ul>
Результат:
Example
Let's change the behavior for the
empty li tag:
html<ul>
<li>list item</li>
<li>list item</li>
<li>list item</li>
<li>list item</li>
<li></li>
</ul>cssli:empty {
border: 1px solid blue;
list-style-type: circle;
color: blue;
width: 100px;
}
Результат:
Example
Let's hide the empty
li completely:
html<ul>
<li>list item</li>
<li>list item</li>
<li>list item</li>
<li>list item</li>
<li></li>
</ul>cssli:empty {
display: none;
}
Результат:
See also
-
the
empty-cellsproperty
that tells the browser how to display the background and border of empty table cells