问题描述
我有这个
.strike {
text-decoration:
}
每次我的 c $ c>,它将从我的
< select>
禁用< option>
这个类,但它不工作在IE。是的,我的< option>
s禁用就好,但文本装饰在IE上失败。这是什么解决方法?谢谢。
编辑:我刚刚发现文字装饰:换行符在Chrome上不起作用。
选项
元素在样式中有许多限制,因为它们的渲染仍然在很大程度上基于系统中的内置例程,那些例程通常不能用CSS控制。 Overstriking通常不工作,因为你可以使用一个简单的静态示例测试< select>< option style =text-decoration:line-through> Hello world< / select>
。 (作为好奇心,Firefox使用直通,但不是在初始状态下初始选择的选项。) 考虑使用另一种方法。如果一个选项不能被选择,为什么不只是删除它? (我的意思是用JavaScript删除元素,使用CSS隐藏它不起作用。)
或者,设置 disabled
属性设置为 true
。这将阻止它被选中,并且将在流行的浏览器上使用灰色文本显示。
I have this
.strike{
text-decoration: line-through;
}
and every time my disable()
is called, it will disable the <option>
s from my <select>
and add this class but it does not work on IE. Yes, my <option>
s are disabled just fine but the text-decoration fails on IE. What is the workaround for this? Thanks.
Edit: I just found out that text-decoration: line-through does not work also on Chrome.
Generally, option
elements have many limitations in styling, since their rendering is still largely based on built-in routines in systems, and those routines are often not controllable with CSS. Overstriking does not usually work, as you can test with a simple static example <select><option style="text-decoration: line-through">Hello world</select>
. (As a curiosity, Firefox uses line through, but not on the initially selected option in the initial state.)
Consider using an alternative approach. If an option cannot be selected, why not just remove it? (I mean deleting the element with JavaScript. Hiding it with CSS does not work well.)
Alternatively, set its disabled
property to true
. This will prevent it from being selected, and it will get displayed using gray text, on popular browsers.
这篇关于文本装饰:直通不工作的IE?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!