:blank

Tree-Structural

The tree-structural pseudo-classes were introduced in CSS3. In level 4 selectors, the :blank pseudo-class is added. These pseudo-classes select elements in the document tree.

The name :blank is likely to change names in the working draft. This page will be updated if necessary when the time comes.

In CSS3, you have the :root and :empty pseudo-classes. In level 4 selectors, you also have :blank.

:blank

The :blank pseudo-class is similar to the :empty pseudo-class (explained below), but it matches elements containing whitespace (spaces, tabs and segment breaks).

:empty (CSS3)

The :empty pseudo-class was introduced in CSS3, but is required to know to understand the :blank pseudo-class. This pseudo-class matches elements with no content.

Browser Support (tested using latest versions)

Desktop
Google Chrome
No
Mozilla Firefox
-moz
Safari
No
Opera Browser
No
Internet Explorer
No
Mobile
Android Browser
No
Chrome for Android
No
Mozilla Firefox Mobile
No
Safari iOS
No
Opera Mobile
No
IE Mobile
No

Syntax

E:blank {
/* Style properties */
}

/* The following are the browser supported versions of the :blank pseudo-class. */

E:-moz-only-whitespace { /* Firefox */ }

Example

/* In this example, all blank p elements will have a margin of 0. Remember that blank elements are elements with no content (not even whitespace!). */

p:blank {
margin: 0;
}

Information is based on Selectors Level 4 - W3C Editor's Draft (last updated on May 24, 2016)
Copyright © 2015 W3C® (MIT, ERCIM, Keio, Beihang), All Rights Reserved. W3C liability, trademark and document use rules apply.