gpt4 book ai didi

html - td 上的 bgcolor 不会改变其颜色

转载 作者:行者123 更新时间:2023-11-28 05:50:41 30 4
gpt4 key购买 nike

我正在使用 zurb foundation 电子邮件 html 框架在电子邮件客户端中显示电子邮件:

默认情况下,按钮类以蓝色呈现 td。

我将 bgcolor 设置为红色,看这里:

http://codepen.io/helloworld/pen/vGqPNR?editors=1100

但颜色没有改变!

这是什么原因?

为了最大的兼容性,我不想使用 style="background:red"

<table class="button">
<tr>
<td>
<table>
<tr>
<td bgcolor="red"><a href="#">Tiny Button</a></td>
</tr>
</table>
</td>
</tr>
</table>

最佳答案

来自 the CSS spec :

The UA may choose to honor presentational attributes in an HTML source document. If so, these attributes are translated to the corresponding CSS rules with specificity equal to 0, and are treated as if they were inserted at the start of the author style sheet. They may therefore be overridden by subsequent style sheet rules.

由于 CSS 规则在表格单元格上设置背景颜色,因此 CSS 会覆盖 HTML 属性。

关于html - td 上的 bgcolor 不会改变其颜色,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/37357364/

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