Detect if an input has text in it using CSS — on a page I am visiting and do not control?

Is there a way to detect whether or not an input has text in it via CSS? I’ve tried using the :empty pseudo-class, and I’ve tried using [value=""], neither of which worked. I can’t seem to find a single solution to this.

I imagine this must be possible, considering we have pseudo-classes for :checked, and :indeterminate, both of which are kind of similar thing.

Please note: I’m doing this for a “Stylish” style, which can’t utilize JavaScript.

Also note, that Stylish is used, client-side, on pages that the user does not control.

17 Answers
17

Leave a Comment