0

I'm just trying to apply some basic styles to different options in a dropdown select element. In Firefox, the styles work, but in Chrome and IE9 the styles don't take effect, even though in Chrome I can see in the debug inspector that the styles are being read and not overridden by any other styles. Any ideas?

E.g this rule:

select option.depth-0 {
    font-weight: bold;
}

On this element:

<option value="1" class="depth-0">Home</option>
Harry F
  • 122
  • 3
  • 10

1 Answers1

2

Swap select and option selectors in your css:

option.depth-0 select{
    font-weight: bold;
}

Edit

Option select element actually not part of browser. It is part of OS. It difficult to style.

For example you can't change height of some option in select element. Changing font-weight assumed that too.

The only option I see is to create your own custom select element. Using JavaScript for example. Then you can customize it as you need using CSS. And it will be crossbrowser.

antyrat
  • 26,950
  • 9
  • 73
  • 75