【问题标题】:html - mso conditional statement not workinghtml - mso 条件语句不起作用
【发布时间】:2020-11-21 12:57:32
【问题描述】:

我正在为一个项目在表单构建器 Mailchimp 中自定义选择加入确认电子邮件模板。 当我发送测试时,Gmail、Yahoo 和 Outlook Web 邮件客户端中的一切看起来都很好,除了 Outlook 桌面应用程序 v16.0,我有一个间距渲染问题。 问题的原因是来自表单构建器的“确认订阅链接/按钮”,它在其后生成<br> 标签,与其他电子邮件客户端不同,Outlook 桌面应用程序没有忽略该标签。 为了解决这个问题,我尝试为 <br> 标签添加 CSS 样式并不显示它,但它似乎不起作用。 我还使用 mso 条件语句来定位这个特定版本的 Outlook 桌面应用程序。我在第一个文本的<td> 中添加了 padding-bottom 并将其放在 mso 中,以具有相等的空格。但不幸的是,Outlook 桌面仍然没有承认这一点。我尝试了很多添加css、margin等的东西,但没有任何效果。知道如何解决这个问题吗?看来我对mso做错了。

我还附上了我在 Gmail、Outlook.com 和 Outlook 桌面应用程序中制作的示例测试电子邮件,以及表单生成器中的默认订阅模板供您查看。 See screenshot here

这是我的代码: 我必须将我的 HTML 分成两部分,以在中间制作“确认订阅链接”。由于此链接无法删除。

https://codepen.io/christine-tine27/pen/QWyeEGz

<!-- PART 1.HTML -->
<div class="es-wrapper-color" style="background-color:#FFFFFF">
    <table class="es-content" cellspacing="0" cellpadding="0" align="center" style="mso-table-lspace:0pt;mso-table-rspace:0pt;border-collapse:collapse;border-spacing:0px;table-layout:auto !important;width:100%">
       <tr style="border-collapse:collapse">
          <td align="center" style="padding:0;Margin:0">
             <table class="es-content-body" cellspacing="0" cellpadding="0" bgcolor="#ffffff" align="center" style="mso-table-lspace:0pt;mso-table-rspace:0pt;border-collapse:collapse;border-spacing:0px;background-color:#FFFFFF;width:600px">
                <tr style="border-collapse:collapse">

                       <!-- ADDED MSO CONDITIONAL STATEMENT FOR OUTLOOK ONLY-->
                        <!--[if gte mso 9]>
                            <td align="left" style="padding-bottom:8px;padding-left:0px;padding-right:20px;padding-top:25px;mso-line-height-rule:exactly;line-height:20px!important;Margin:0;">
                        <![endif]-->
                        <!-- END  -->

                   <td align="left" style="padding-bottom:0px;padding-left:0px;padding-right:20px;padding-top:25px;mso-line-height-rule:exactly;line-height:20px!important;Margin:0;">
                      <table cellpadding="0" cellspacing="0" width="100%" style="mso-table-lspace:0pt;mso-table-rspace:0pt;border-collapse:collapse;border-spacing:0px">
                         <tr style="border-collapse:collapse">
                            <td align="center" valign="top" style="padding:0;Margin:0;width:560px">
                               <table cellpadding="0" cellspacing="0" width="100%" role="presentation" style="mso-table-lspace:0pt;mso-table-rspace:0pt;border-collapse:collapse;border-spacing:0px">
                                  <tr style="border-collapse:collapse">
                                     <td align="left" style="padding:0;Margin:0">
                                        <p style="Margin:0;padding:0 0 0px 0;-webkit-text-size-adjust:none;-ms-text-size-adjust:none;mso-line-height-rule:exactly;font-size:14px;font-family:arial, 'helvetica neue', helvetica, sans-serif;line-height:21px;color:#333333;text-align:justify">You’re just one step away</p>
                                     </td>
                                  </tr>
                               </table>
                            </td>
                         </tr>
                      </table>
                   </td>
                </tr>
             </table>
          </td>
       </tr>
    </table>
 </div>


<!-- PART 2.HTML -->
 <div class="es-wrapper-color" style="background-color:#FFFFFF">
    <table class="es-content" cellspacing="0" cellpadding="0" align="center" style="mso-table-lspace:0pt;mso-table-rspace:0pt;border-collapse:collapse;border-spacing:0px;table-layout:auto !important;width:100%">
       <tr style="border-collapse:collapse">
          <td align="center" style="padding:0;Margin:0">
             <table class="es-content-body" cellspacing="0" cellpadding="0" bgcolor="#ffffff" align="center" style="mso-table-lspace:0pt;mso-table-rspace:0pt;border-collapse:collapse;border-spacing:0px;background-color:#FFFFFF;width:600px">
                <tr style="border-collapse:collapse">
                   <td align="left" style="Margin:0;padding-bottom:0px;padding-left:0px;padding-right:0px;padding-top:0px">
                      <table cellpadding="0" cellspacing="0" width="100%" style="mso-table-lspace:0pt;mso-table-rspace:0pt;border-collapse:collapse;border-spacing:0px">
                         <tr style="border-collapse:collapse">
                            <td align="center" valign="top" style="padding:0;Margin:0;width:560px">
                               <table cellpadding="0" cellspacing="0" width="100%" role="presentation" style="mso-table-lspace:0pt;mso-table-rspace:0pt;border-collapse:collapse;border-spacing:0px">
                                  <tr style="border-collapse:collapse">
                                     <td align="left" style="padding:0;Margin:0">
                                        <p style="Margin:0;padding:0px 0px 0px 0px;-webkit-text-size-adjust:none;-ms-text-size-adjust:none;mso-line-height-rule:exactly;font-size:14px;font-family:arial, 'helvetica neue', helvetica, sans-serif;line-height:21px;color:#333333;text-align:justify"> Upon confirmation, you'll receive an email with an exclusive 10% off food &amp; beverage code which can be redeemed during your next stay.<br><br>Warmly,<br>The </p>
                                     </td>
                                  </tr>
                               </table>
                            </td>
                         </tr>
                      </table>
                   </td>
                </tr>
             </table>
          </td>
       </tr>
    </table>
 </div>

【问题讨论】:

    标签: html html-email email email-templates


    【解决方案1】:

    要让 Outlook 显示间隙,它需要呈现一些内容,例如文本。我们可以使用不间断的空间。确定高度所需的关键属性是line-height 和font-size。

    另外,由于这是一行,你应该插入一个&lt;tr&gt;,因此它应该在另一个&lt;tr&gt;之前。虽然我不太明白你想在这里做什么。

    <!--[if gte mso 9]>
    <tr>
      <td align="left" style="padding:0;margin:0;mso-line-height-rule:exactly;line-height:20px;font-size:20px;">&nbsp;</td>
    </tr>
    <![endif]-->
    

    另外需要注意的是,Outlook(至少是台式机)会删除带有“!important”标签的任何内容。

    但我不确定为什么这首先不起作用 - 跨电子邮件兼容的电子邮件可以通过填充实现这一点,&lt;br&gt; 没有问题。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2022-01-25
      • 2011-01-08
      • 2011-12-04
      • 2012-08-15
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多