下拉列表中选项的粗体部分 [英] Bold part of an option in a drop down list

查看:21
本文介绍了下拉列表中选项的粗体部分的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有没有办法在下拉列表选项中只加粗部分文本,或者这是不可能的?

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

我知道您可以使用 CSS 设置整个选项的样式,但这不是我想要的.并且选项标签内的 HTML 不会呈现.

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 - ID 描述

推荐答案

您不能这样做.您会在那里"找到的最有可能的解决方案是添加具有硬编码样式的周围跨度,但 IE (7) 和 Firefox (3.0.12) 都不支持这一点.其实在火狐浏览器中查看生成的源码,内部的span是完全剥离出来的.

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.

您可以做的是使用 JavaScript 解决方案为您提供选择的外观,而无需实际使用选择.

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

这里有一个很棒的 HOWTO 如何做到这一点:http://www.devirtuoso.com/2009/08/styling-drop-down-boxes-with-jquery/

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

这篇关于下拉列表中选项的粗体部分的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆