These questions are similar but not the same or are very outdated:
- HTML font weight property on OPTION of HTML SELECT
- How to style the option of an html "select" element?
- How can I change the font-size of a select option?
The goal is to style different options of the same select menu with different font-weights. We only need to support modern browsers.
This code doesn't work, even though answers on Stack Overflow and elsewhere suggest it should in modern browsers like Chrome.
Here's an example of what it looks like when using the answer from @gravgrif, which shows all the options styled the same:
Another alternative that did not help was bundling each option
in an optgroup
, and styling the optgroup
.
<select class="weightMenu" title="Bold options available">
<option value="200" style="font-weight:200">B</option>
<option value="300" style="font-weight:300">B</option>
</select>
The goal is to use native HTML and CSS. No plug-ins.