跨度内td不覆盖td样式 [英] Span inside td does not override td style
本文介绍了跨度内td不覆盖td样式的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我在 td
中有一个 span
标记。 td
有一个带CSS的类设置 text-decoration
到下划线
,而 span
将 text-decoration
设置为 none
。我期望 span
里面的文本不加下划线,但由于某种原因它是。为什么?
I have a span
tag inside a td
. The td
has a class with CSS to set the text-decoration
to underline
, while the span
sets the text-decoration
to none
. I expect the text inside the span
to not be underlined, but for some reason it is. Why?
.u {
text-decoration: underline;
}
.no-u {
text-decoration: none !important;
}
<table>
<tr>
<td class="u">
<span class="no-u" style="text-decoration: none !important;">My Text</span>
</td>
</tr>
</table>
推荐答案
无法删除后代的下划线样式。
Cannot remove the underlined style for descendants.
http://www.w3.org/TR/CSS21/text.html#lining-striking-props
后代元素上的'text-decoration'属性不能对祖先的装饰产生任何
效果。
The 'text-decoration' property on descendant elements cannot have any effect on the decoration of the ancestor.
这篇关于跨度内td不覆盖td样式的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文