A partial archive of discourse.wicg.io as of Saturday February 24, 2024.

Attribute selector for length based attributes should allow for selection by range

ShakespeareFan00
2020-05-09

https://drafts.csswg.org/selectors-4/#attribute-selectors Section 6.1

There should be a selector to allow for a rule like

’ div [width bounds(,10em) ] span bar{ font-size:0.5em }

div [width bounds(10em,) ] span bar{ font-size:1em } ’

Which in an implementation would cause a different font-size to be applied if the width of the relevant DIV was within the specified bounds. ( It’s already possible with @media to have different styles based on screen width.

Intended selector function : bounds ( lower, upper) .

If lower is unspecified then use a value of 0 for any comparison. If upper is unspecified then use an appropriate maximal value for any comparison.

The style rule implemented for the given selector would only be applied if the value of the attribute 'determined dynamically in an appropriate way was within the bounds specified.

Is there someone here that’s able to assist in expanding the above short description into something more formalized?