1

我目前正在尝试为我的 html 电子邮件布局构建一个 if / else 以包含不同的表格标签。这就是我正在尝试的:

<!--[if mso]>
<table class="content-table" role="presentation" cellpadding="0" cellspacing="45" align="center" border="0">
<![endif]-->
<!--[if !mso]> <!---->
<table class="content-table" role="presentation" cellpadding="0" cellspacing="0" align="center" border="0">
<!-- <![endif]-->
</table>

因此,如果邮件在 Outlook 中打开,我会尝试使用不同的 beginn 标签开始我的表格。但这不起作用。怎么了?

这不是重复的!

4

1 回答 1

3

这是一个如何在 Outlook 中显示和隐藏的示例。如果您在 Outlook 中查看此内容,您将看到“Outlook”一词。如果您在现代电子邮件客户端中查看它,您会看到“现代电子邮件”字样。

https://jsfiddle.net/wallyglenn/5hruzos5/1/

<table>
<tr>
    <td>
        <!--[if !mso]><!-- -->
        <img src="http://via.placeholder.com/300x300/0000ff/?text=Modern+Email" alt="Modern+Email" width="100%" style="display:inline-block;border:none;outline:none;padding:0;margin:0;width:100%;height:auto;" border="0" hspace="0" vspace="0">
        <!--<![endif]-->
        <!--[if gte mso 9]>
        <img src="http://via.placeholder.com/300x300/ff0000?text=Outlook" alt="" width="100%" style="display:inline-block;border:none;outline:none;padding:0;margin:0;width:100%;height:auto;" border="0" hspace="0" vspace="0">
        <![endif]-->
    </td>
</tr>
</table>

祝你好运。

于 2018-11-12T23:59:29.557 回答