Firefox Tomorrow

css pseudo class

`:-moz-only-whitespace` CSS pseudo-class

View on MDN ↗

[!NOTE] In Selectors Level 4, the :empty selector was changed to act like :-moz-only-whitespace, but no browser currently supports this yet.

The :-moz-only-whitespace CSS pseudo-class matches elements that only contain text nodes that only contain whitespace. (This includes elements with empty text nodes and elements with no child nodes.)

Syntax

:-moz-only-whitespace {
  /* ... */
}

Examples

Basic :-moz-only-whitespace example

HTML

<div> </div>

CSS

div {
  border: 4px solid red;
}

:-moz-only-whitespace {
  border-color: lime;
}

Result

Interactive exampleOpen the canonical MDN source to run this embedded demo.

Specifications

Briefly defined as :blank in Selectors Level 4, but then the functionality was merged into :empty and :blank redefined to mean empty <input>.

Browser compatibility

Browser compatibilityCompatibility data is available on the canonical MDN page.

See also