根据this页面,只有适用于 Outlook 2016 之前的 Outlook 版本的 MSO 条件。这是否意味着它们仅用于向后兼容?
如果第一个问题的答案是肯定的,并且您的目标不是 Outlook 向后兼容性。生成电子邮件时还需要使用 MSO 条件吗?
MSO 条件或条件注释仅在使用 Word 渲染引擎的 Windows 上的 Outlook 中受支持。从 Outlook 2007 开始,一直到最新版本的 Outlook 2021。2016 年之前的版本都有唯一的版本号,这使得它们很容易成为唯一的目标。但在 Outlook 2016 之后,他们停止增加该版本号,因此在 Outlook 2016 之后,不再可能在 Windows 上定位特定版本的 Outlook。
作为一名电子邮件开发人员,我仍然非常依赖条件注释。因为 Word 作为渲染引擎非常棘手,所以最好给它提供
<table>
s。例如,默认情况下,我将为大多数电子邮件客户端提供基于 <div>
的流畅布局。但由于 Windows 上的 Outlook(使用 Word 的渲染引擎)不支持 max-width
元素上的 div
之类的内容,因此我将使用条件注释和 The Outlooks 的固定宽度表来包装它。
<!--[if mso]>
<table border="0" cellpadding="0" cellspacing="0" align="center" style="width:600px;" role="presentation"><tr><td>
<![endif]-->
<div style="width:100%; max-width:600px; margin:0 auto;">
Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod
tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam.
</div>
<!--[if mso]>
</td></tr></table>
<![endif]-->
微软目前正在从 Word 过渡,Windows 上最新版本的 Outlook 使用 EdgeView 作为渲染层,因此不再支持条件注释。只要用户仍然在运行 Word 渲染引擎的 Windows 上使用 Outlook 版本,我就会继续在 HTML 电子邮件中使用条件注释,并且我建议这样做。