:-moz-only-whitespace

Non-standard: This feature is non-standard and is not on a standards track. Do not use it on production sites facing the Web: it will not work for every user. There may also be large incompatibilities between implementations and the behavior may change in the future.

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

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

Examples

Basic :-moz-only-whitespace example

HTML

html
<div> </div>

CSS

css
div {
  border: 4px solid red;
}

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

Result

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

Report problems with this compatibility data on GitHub
desktopmobile
Chrome
Edge
Firefox
Opera
Safari
Chrome Android
Firefox for Android
Opera Android
Safari on iOS
Samsung Internet
WebView Android
WebView on iOS
:-moz-only-whitespace
Non-standard

Legend

Tip: you can click/tap on a cell for more information.

Full support
Full support
No support
No support
Non-standard. Check cross-browser support before using.
See implementation notes.

See also