This is an experimental technology
Check the Browser compatibility table carefully before using this in production.

The :blank CSS pseudo-class matches elements that have no child nodes at all, or only have empty text nodes or text nodes that have only whitespace in them.

Syntax

:blank

Example

HTML

<div> </div>

CSS

div {
  border: 4px solid red;
}

:blank {
  border-color: lime;
}

Result

Specifications

Specification Status Comment
Selectors Level 4
The definition of ':blank' in that specification.
Working Draft Initial definition

Browser compatibility

Update compatibility data on GitHub
DesktopMobile
ChromeEdgeFirefoxInternet ExplorerOperaSafariAndroid webviewChrome for AndroidEdge MobileFirefox for AndroidOpera for AndroidiOS SafariSamsung Internet
Basic support
Experimental
Chrome No support NoEdge No support NoFirefox Full support Yes
Notes Alternate Name
Full support Yes
Notes Alternate Name
Notes See bug 1106296.
Alternate Name Uses the non-standard name: :-moz-only-whitespace
IE No support NoOpera No support NoSafari No support NoWebView Android No support NoChrome Android No support NoEdge Mobile No support NoFirefox Android Full support Yes
Notes Alternate Name
Full support Yes
Notes Alternate Name
Notes See bug 1106296.
Alternate Name Uses the non-standard name: :-moz-only-whitespace
Opera Android No support NoSafari iOS No support NoSamsung Internet Android No support No

Legend

Full support  
Full support
No support  
No support
Experimental. Expect behavior to change in the future.
Experimental. Expect behavior to change in the future.
See implementation notes.
See implementation notes.
Uses a non-standard name.
Uses a non-standard name.

See also

Document Tags and Contributors

Contributors to this page: ExE-Boss, mfluehr, Sebastianz, teoli, Sheppy, ethertank, Marsf, Fredchat, Mw22
Last updated by: ExE-Boss,