td 上的 bgcolor 不会改变其颜色
bgcolor on td does not change its color
我正在使用 zurb foundation email html 框架在电子邮件客户端中显示电子邮件:
默认情况下,按钮 class 以蓝色呈现 td。
我将 bgcolor 设置为红色,看这里:
http://codepen.io/helloworld/pen/vGqPNR?editors=1100
但是颜色没变!
这是什么原因?
为了最大的兼容性,我不想使用样式="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 规则在 table 单元格上设置背景颜色,因此 CSS 会覆盖 HTML 属性。
我正在使用 zurb foundation email html 框架在电子邮件客户端中显示电子邮件:
默认情况下,按钮 class 以蓝色呈现 td。
我将 bgcolor 设置为红色,看这里:
http://codepen.io/helloworld/pen/vGqPNR?editors=1100
但是颜色没变!
这是什么原因?
为了最大的兼容性,我不想使用样式="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 规则在 table 单元格上设置背景颜色,因此 CSS 会覆盖 HTML 属性。