Tree-Structural :blank
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.
: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 builds on the :empty pseudo-class (explained below), but it also 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
| Chrome | Firefox | Safari | Opera | IE | Edge | |
|---|---|---|---|---|---|---|
| Desktop | no | -moz | no | no | no | no |
| Mobile | no | no | no | no | no | 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. */
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.