Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Bold part of an option in a drop down list

Is there a way to bold only part of the text in a drop down list option or is this not possible?

I know that you can style the entire option with CSS, but that is not what I am looking for. And HTML inside of an option tag does not render.

Here would be an example of a drop down list item:

SomeID - Description of ID

like image 451
Bryan Denny Avatar asked Aug 03 '09 15:08

Bryan Denny


2 Answers

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. In fact, if you look at the generated source in Firefox, the internal span is completely stripped out.

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

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

like image 158
Tony Miller Avatar answered Sep 27 '22 20:09

Tony Miller


Not possible or at least not working cross browsers. If you really need this, you can create your own dropdown but I wouldn't recommend it.

like image 26
marcgg Avatar answered Sep 27 '22 21:09

marcgg