Web/CSS/ blank

From Get docs

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


Note: The :blank selector is considered at risk, as the CSSWG keeps changing it.

See CSSWG issue #1967.


The :blank CSS pseudo-class selects empty user input elements (e.g. <input> or <textarea>).

Syntax

:blank

Examples

Simple :blank example

In eventual supporting browsers, the :blank pseudo-class will enable developers to highlight in some way input controls that are not required, but still have no content filled in, perhaps as a reminder to users.

HTML

<textarea></textarea>

CSS

textarea:blank {
  border: 3px solid red;
}

Result

Specifications

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

Browser compatibility

Update compatibility data on GitHub

Desktop Mobile
Chrome Edge Firefox Internet Explorer Opera Safari Android webview Chrome for Android Firefox for Android Opera for Android Safari on iOS Samsung Internet

:blank

Experimental'

Chrome

No support No

Edge

No support No

Firefox No support No

Notes'

No support No

Notes'

Notes' See bug 1197736.

IE

No support No

Opera

No support No

Safari

No support No

WebView Android

No support No

Chrome Android

No support No

Firefox Android

No support No

Opera Android

No support No

Safari iOS

No support No

Samsung Internet Android

No support No

Legend

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.


See also

:blank by Mozilla Contributors is licensed under CC-BY-SA 2.5.