CSS selector based on width?

Is there a CSS rule that would match elements based on their width?

No.

If not, would it be interesting to propose that in the standard?

Maybe, but not the Selectors standard, because Selectors is not intended to be tightly coupled with the styling aspect of CSS.

There were proposals to standardize something called “element queries” a few years ago, but other than a few proofs-of-concept, they seem to have mostly dissipated. Probably because they’re just not feasible to spec and implement in a way that is robust (cyclic dependencies immediately come to mind).

Leave a Comment