Skip to content

CSS Selectors

Empty

About

The :empty pseudo-class matches elements that have no content.

Empty element

Empty elements like div are matched by the :empty selector.

Element with text

An element with a whitespace character or any other text is not matched by the :empty selector.

HTML comments

An element with just an HTML comment is considered empty and is matched by the :empty selector.