CSS Blank Pseudo
Last updated
Last updated
CSS Blank Pseudo lets you style form elements when they are empty, following the Selectors Level 4 specification.
From the command line, transform CSS files that use :blank
selectors:
Next, use your transformed CSS with this script:
That’s it. The script is 509 bytes and works in all browsers.
If you support Internet Explorer 11, use the browser legacy script, which is 671 bytes:
The PostCSS plugin clones rules containing :blank
, replacing them with an alternative [blank]
selector.
Next, the JavaScript library adds a blank
attribute to elements otherwise matching :blank
natively.