【发布时间】:2015-07-21 16:30:53
【问题描述】:
我在一个 PHP 程序中嵌入了这个 CSS,用于显示表格的背景颜色。
<style>
table {
width:100%;
}
table, th, td {
border: 1px solid black;
border-collapse: collapse;
}
th, td {
padding: 5px;
text-align: left;
}
table#t01 tr:nth-child(even) {
background-color: #eeeeee;
}
table#t01 tr:nth-child(odd) {
background-color:#ffffff;
}
table#t01 th {
background-color: black;
color: white;
}
</style>
我有这个:
<TABLE id="t01">
我获取了这个 PHP 程序的原始输出,将其保存为 .html 文件,将其上传到服务器,它的行为符合我的预期。但是当作为 HTML gmail 时,它根本不显示背景颜色。
如果我在 HTML 上添加 bgcolor="black" 就可以了。所以我知道必须可以在 html gmail 中做背景颜色,但显然我没有在这里做。
PHP 程序生成表格,我真的想让 CSS 处理行的奇数/偶数颜色。
对此有什么优雅的编程解决方案?谢谢!
【问题讨论】:
标签: css gmail html-email