【发布时间】:2020-01-20 14:12:32
【问题描述】:
我知道这个顶部已经被讨论了很多,我并没有从我的搜索中看到任何类似的案例。也许我错了。我觉得这太不可思议了,所以我想知道是否有人能给我一些启示。
我在两张桌子下面有一个嵌套另一个。一个带有下划线,一个没有。请参阅下面的代码。据我了解,即使外表的下划线样式有效(应该是没有文字的缘故),它应该在嵌套表格下方显示一行(注意表格有填充内)。但是这条线看起来像是在嵌套表上设置的......
<table width="640" align="center" bgcolor="#000001">
<tr>
<td style="color:#ff0000; text-decoration:underline;">
<table width="100%">
<tr>
<td style="color:#ffffff; font-size:14px; text-decoration:none; padding:30px 0;" align="center">
<a href="https://google.com" style="color:#ffffff; text-decoration:none">Text here</td>
</tr>
</table>
</td>
</tr>
</table>
如果你在外表上添加一个大字体大小,那就太疯狂了。你会得到下面的结果。
<table width="640" align="center" bgcolor="#000001">
<tr>
<td style="color:#ff0000; text-decoration:underline; font-size: 100px;">
<table width="100%">
<tr>
<td style="color:#ffffff; font-size:14px; text-decoration:none; padding:30px 0;" align="center">
<a href="https://google.com" style="color:#ffffff; text-decoration:none">Text here</td>
</tr>
</table>
</td>
</tr>
</table>
如果您认为这对您来说更容易,我在CodePen 上有代码。
顺便说一句,幽灵下划线在 Firefox 中是 RED 而在 Chrome 中是 WHITE。如果您对此也有任何想法,那也让我感到困惑。请告诉我。
有什么想法吗?
【问题讨论】:
-
文字装饰是为了...好吧文字,尝试将边框设置为无
-
相关了解正在发生的事情:stackoverflow.com/a/59028672/8620333
-
删除
text-decoration:underline;并使用边框。 -
如果您制作嵌套表
inline-table,您将解决您的问题 (stackoverflow.com/a/54816896/8620333) -
sitepoint.com/text-decoration-css-property 无法撤消祖先的文本装饰。