【发布时间】:2021-12-04 01:33:29
【问题描述】:
<html><head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"><style>
body {
font-family: 'Quicksand', sans-serif;
}
.delimiter {
color: gray;
}
</style>
</head>
<body bgcolor="#EEEEEE">
<table align="center" width="800" cellpadding="10" cellspacing="0" border="0" bgcolor="#FFFFFF">
<tr>
<td style="display: none;" bgcolor="#FFD500" align="left" width="25%"><img height="40px" src=""></td>
<td bgcolor="#FFD500" align="center" style="text-align:center; vertical-align:middle; color: #000000; font-family: sans-serif; font-size: 32px;font-weight: bold;" colspan="2">Hello World</td>
<td style="display: none;" bgcolor="#FFD500" align="right" width="25%"><img height="40px" src=""></td>
</tr>
</table>
</body>
</html>
上面的代码是正在使用的 HTML。 HTML 也直接从 Outlook 复制过来,因此 Outlook 电子邮件和 chrome 页面的 HTML 是相同的(相同的 HTML)。
这是我在 chrome 中得到的:https://i.stack.imgur.com/3Nde2.png
这是我在 Outlook 中得到的:https://i.stack.imgur.com/4l6tJ.png
这两个 HTML 代码是相同的,虽然它在 chrome 中可以正常工作,但在 Outlook 中却不能。它应该为两个单元格显示:none,尽管它只对右侧的图像而不是左侧的图像显示。
这也很奇怪,因为它并不是在 Outlook 中不能完全工作,它适用于右侧的单元格/图像,但不适用于左侧的单元格/图像,即使我已经检查过并且它们几乎相同。这可能是什么原因造成的?
我还尝试了围绕我的 tr 标签的 Outlook 条件 CSS (!--[if mso]> 和
【问题讨论】:
-
您使用的是 Outlook 2007 到 2016 吗? Windows 上的 Outlook (2007-2016) 不支持 display:none。您可以在
或
上尝试 mso-hide:all。 是的,这很奇怪,因为 display:none 在隐藏右侧的单元格/图像时有效,但不适用于左侧对应项。另外,我刚刚尝试使用 mso-hide:all,尽管由于某种原因它在 Outlook 中仍然给出了相同的结果。<td style="mso-hide: all;" bgcolor="#FFD500" align="left" width="25%"><img height="40px" src=""></td>如果您将其应用到表格而不是单个单元格会怎样?然后整个 hello world 和黄色桌子就消失了。