Hiding Options in a Select Menu with CSS
When hiding
To resolve this issue, consider using the hidden attribute instead of CSS to hide options. This attribute is supported in HTML5 and disables both the visibility and selection of hidden options:
<option hidden>Hidden option</option>
While Internet Explorer versions below 11 do not support hidden, it may be a suitable solution if only a few options need to be hidden. By combining the hidden attribute with disabled, you can prevent hidden options from being accidentally selected:
<select> <option>Option1</option> <option>Option2</option> <option hidden disabled>Hidden Option</option> </select>
The above is the detailed content of Why Do Hidden Options Show in Chrome's Select Menu?. For more information, please follow other related articles on the PHP Chinese website!