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 contains text nodes that only contain whitespace. (This includes elements with empty text nodes and elements with no child nodes.)
Syntax
Syntax not found in DB!
Examples
HTML
<div> </div>
CSS
:root { overflow: hidden; max-width: 100vw; max-height: 100vh; } div { background-color: #ccc; box-sizing: border-box; height: 100vh; min-height: 16px; min-height: 1rem; }
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
Desktop | Mobile | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|
:-moz-only-whitespace | Chrome No support No | Edge No support No | Firefox
Full support
1
| IE No support No | Opera No support No | Safari No support No | WebView Android No support No | Chrome Android No support No | Firefox Android
Full support
4
| Opera Android No support No | Safari iOS No support No | Samsung Internet Android No support No |
Legend
- Full support
- Full support
- No support
- No support
- Non-standard. Expect poor cross-browser support.
- Non-standard. Expect poor cross-browser support.
- See implementation notes.
- See implementation notes.