Tree-Structural
The tree-structural pseudo-classes were introduced in CSS3. In CSS4, 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 CSS4, 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
Syntax
E:blank {
/* Style properties */
}
/* The following are the browser supported versions of the :blank pseudo-class. */
E:-moz-only-whitespace {
/* Style properties */
}
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 April 15, 2015)
Copyright © 2015 W3C® (MIT, ERCIM, Keio, Beihang), All Rights Reserved. W3C liability, trademark and document use rules apply.