gpt4 book ai didi

html - td 内的跨度不会覆盖 td 样式

转载 作者:太空狗 更新时间:2023-10-29 15:50:31 26 4
gpt4 key购买 nike

我在 td 中有一个 span 标签。 td 有一个带有 CSS 的类,用于将 text-decoration 设置为 underline,而 span 设置 text-decorationnone。我希望 span 中的文本不带下划线,但出于某种原因它是。为什么?

.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>

最佳答案

无法删除后代的下划线样式。

http://www.w3.org/TR/CSS21/text.html#lining-striking-props

The 'text-decoration' property on descendant elements cannot have any effect on the decoration of the ancestor.

关于html - td 内的跨度不会覆盖 td 样式,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/18493374/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com