The :empty CSS pseudo-class represents any element that has no children. Children can be either element nodes or text (including whitespace).
HTML Code -
<div> Hello World !!!</div>
<div> <!-- Empty --> </div>
<div> GoodBye World !!! </div>
CSS Code -
div:empty {
background-color: #ff0000;
}
Output -
Top comments (0)