The rendering of SELECT
elements is largely up to the browser, you have very little influence over their presentation. Some browsers obviously allow you more customization than others, IE happens to allow very little (gasp, who’d have thunk ;)). If you need very custom SELECT
elements, you’ll need to employ JavaScript or re-create something that behaves like a SELECT
but is made of a bunch of DIV
s and checkboxes or something to that extend.
Having said that, I think what you’re looking for are OPTGROUP
s:
<select>
<optgroup label="xxx">
<option value="xxxx">xxxx</option>
....
</optgroup>
<optgroup label="yyy">
...
</optgroup>
</select>
Every browser will display them differently, but they’ll be displayed in a distinctive fashion in one way or another. Note though that officially in HTML4 you can’t nest OPTGROUP
s.