跨电子邮件客户端HTML邮件v:矩形按钮宽度为100%

问题描述 投票:0回答:1

我有这个难看的代码,用于在MS Outlook的HTML电子邮件中创建按钮:

  <!--[if mso]>
  <v:rect xmlns:v="urn:schemas-microsoft-com:vml" xmlns:w="urn:schemas-microsoft-com:office:word" href="https://www.website.com" target="_blank" style="height:50px;width:100%;v-text-anchor:middle;" stroke="f" fillcolor="#009CDE">
      <w:anchorlock/>
      <center>Watch the brand commercial</center>
  </v:rect>
  <![endif]-->

当我使用600px的宽度时,它确实起作用。但是,当我在MS Outlook中调整屏幕大小时,它没有响应。

但是如果我使用100%的with,它会中断。那么是否可以在100%元素上使用v:rect的宽度?

enter image description here

html outlook html-email mailchimp email-templates
1个回答
3
投票

代替v:rect的width:100%,使用mso-width-percent:1000;

1000 = 100%

但是为什么要让自己头痛呢?创建一个响应式按钮,该按钮可以在Outlook 中与其他所有表一起使用,]

<table width="100%" border="0" cellspacing="0" cellpadding="0">
    <tbody>
        <tr>
            <td class="one-column" style="padding-top:0;padding-bottom:0;padding-right:0;padding-left:0;border-collapse:collapse;">
                <table width="100%" style="border-collapse:collapse;mso-table-lspace:0pt;mso-table-rspace:0pt;border-spacing:0;font-family:Arial, sans-serif;color:#333333;">
                    <tr>
                        <td style="padding-top:10px;padding-bottom:10px;padding-right:0;padding-left:0;border-collapse:collapse;">
                            <center>
                                <table border="0" cellpadding="0" cellspacing="0" style="margin:0 auto;">
                                    <tbody>
                                        <tr>
                                            <td align="center" bgcolor="#D90432" width="200" style="-moz-border-radius: 0px; -webkit-border-radius: 0px; border-radius: 0px; padding-bottom: 15px; padding-left: 15px; padding-right: 15px; padding-top: 15px; border: none; line-height:20px;color:#ffffff;">
                                                <a href="https://www.google.com.au" style="text-decoration: none;color:#ffffff;display:block;">Watch This</a>
                                            </td>
                                        </tr>
                                    </tbody>
                                </table>
                            </center>
                        </td>
                    </tr>
                </table>
            </td>
        </tr>
    </tbody>
</table>

或者您也可以只使用锚标记,但是在Outlook中您会失去背景。

© www.soinside.com 2019 - 2024. All rights reserved.