Bold part of an option in a drop down list

时间秒杀一切 提交于 2019-12-01 15:53:25

问题


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


回答1:


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/




回答2:


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.



来源:https://stackoverflow.com/questions/1223074/bold-part-of-an-option-in-a-drop-down-list

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!