2

Is there any way to make an <option> tag bold in a select box in Chrome and IE using CSS? It's working in Firefox.

option.red {
    background-color: #cc0000; 
    font-weight: bold; 
    font-size: 12px; 
    color: white;
}
<select name="color">
    <option class="red" value="red">Red</option>
    <option value="white">White</option>
    <option value="blue">Blue</option>
    <option value="green">Green</option>
</select>

This is the same question as here, but there was no answer.

Community
  • 1
  • 1
raki
  • 2,253
  • 8
  • 33
  • 42

3 Answers3

2

You cannot do this. The most likely solution you'll find "out there" would be to add a surrounding span with hard coded style, but neither IE (7) nor Firefox (3.0.12) honor this.

What you can do is use a JavaScript solution to give you the appearance of a select without actually using a select.

And here's a great "howto" on how to do it: http://www.devirtuoso.com/2009/08/styling-drop-down-boxes-with-jquery/

Raab
  • 34,778
  • 4
  • 50
  • 65
0

I used <option class="bold">Bold Text here</option>

with CSS:

option.bold {
     font-weight:bold;
}

and it worked for Firefox (Mac and Windows) and for IE11, but not for Chrome or Safari.

Ankur Aggarwal
  • 2,993
  • 5
  • 30
  • 56
0

Since Chrome doesn't allow bold font on option tag, you can use text-shadow property like

text-shadow: 0px 0px 0px black;

It will give same appearance of bold and work on all the browsers.

slavoo
  • 5,798
  • 64
  • 37
  • 39
Pritesh
  • 167
  • 1
  • 3