css select dropdown bold on some <option>'s

user991830 picture user991830 · Jan 31, 2012 · Viewed 57k times · Source

On a select dropdown, I need to make certain items 'strong/bold'.

How can I do this?

Example of what I ideally require:

<option value="#"><strong>Andorra</strong></option> 
<option value="#">--Grandvalira</option> 
<option value="#">--Vallnord</option> 
<option value="#"><strong>Austria</strong></option> 
<option value="#">--Amadé</option> 
<option value="#">--Bad Kleinkirchheim</option> 
<option value="#">--Mallnitz</option>

Answer

Royi Namir picture Royi Namir · Jan 31, 2012

You actually can't.

The closest thing (you can't choose a bold item)

 <optgroup label="Swedish Cars">
    <option value="volvo">Volvo</option>
    <option value="saab">Saab</option>
  </optgroup>
  <optgroup label="German Cars">
    <option value="mercedes">Mercedes</option>
    <option value="audi">Audi</option>
  </optgroup>

Which gives you this: enter image description here

http://www.w3schools.com/tags/tryit.asp?filename=tryhtml_optgroup

You can also build one of your own but it won't be input an input tag (you should use inputs of your own).