There is no such selector in CSS. Selectors can only select elements or pseudo-elements, and there is no pseudo-element that would help here.
You can, however, hide the text with CSS, if the label
element contains only the select
element and the text to be hidden. You would hide the label
element and “unhide” the select
element. You cannot use display: none
, since it hides all children. But there are other ways.
Perhaps the simplest is this:
label { visibility: hidden;}
select { visibility: visible; }
You can alternatively set the font size to zero and then the desired font size on the select
element:
label { font-size: 0; }
select { font-size: 12pt; }
Unfortunately, you need to set the font size in physical units here (or use the rem
unit, but its browser support is still limited).
Some browsers have a setting for minimal font size, but it does not seem to apply to a zero font size.