See whatwg/html#7050
Chromium supports a :-internal-list-box
pseudo-class in the UA stylesheet, which matches <select>
elements that render as a list box instead of as a dropdown box.
Gecko similarly supports :-moz-select-list-box
in the UA stylesheet.
WebKit seems to use attribute selectors instead, although I think it's not entirely accurate since the decision per spec depends on the parsing result of the size
attribute. (Demo: <select size="+02xyz">
)
Web developers could rely on the multiple
attribute being present to target list boxes, but that might not always work so well, in particular if you're writing CSS that should work for arbitrary HTML.
I think it makes sense to add a pseudo-class that matches select
elements that are list boxes, e.g. :select-list-box
. To match drop-downs, you can do select:not(:select-list-box)
.
Spec: https://drafts.csswg.org/selectors/
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.3