我在td
中有span
标记。 td
有一个带CSS的类来将text-decoration
设置为underline
,而span
将text-decoration
设置为none
。我期望span
中的文字不会被加下划线,但由于某些原因,它是。为什么?td内的跨度不会覆盖td样式
.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>
跨度没有下划线;表格单元格仍然具有下划线。换句话说,下划线被应用于单元格,而不是跨度,因此您对跨度的规则没有明显的影响。 – j08691
阅读@ j08691评论,只是尝试在跨度上设置'text-decoration:overline;',你会看到* underlne *和* overline *在一起:http://jsfiddle.net/hashem/mfV5V/3/ –
你可能会发现这个主题很有用:http://stackoverflow.com/questions/7113520/text-decorationnone-doesnt-remove-text-decoration –