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
The compatibility table on this page is generated from structured data. If you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request.
Update compatibility data on GitHub
Desktop | Mobile | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|
|
Chrome
No support No |
Edge
No support No |
Firefox No support No No support No 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.