前景中没有图像的圆角

Dan*_*nny 24 html css email

我可以在许多客户端创建圆角

style="-moz-border-radius: 15px; border-radius: 15px;"
Run Code Online (Sandbox Code Playgroud)

但是,此CSS不会在Outlook中创建圆角.有没有简单的方法在Outlook中创建没有图像的圆角?

Van*_*ert 48

此代码使用Outlook条件注释()和VML在Outlook 2010中生成带圆角的按钮:

    <div>
    <!--[if mso]>
    <v:roundrect xmlns:v="urn:schemas-microsoft-com:vml" xmlns:w="urn:schemas-microsoft-com:office:word" href="http://www.EXAMPLE.com/" style="height:40px;v-text-anchor:middle;width:300px;" arcsize="10%" stroke="f" fillcolor="#d62828">
        <w:anchorlock/>
        <center style="color:#ffffff;font-family:sans-serif;font-size:16px;font-weight:bold;">
            Button Text Here!
        </center>
    </v:roundrect>
    <![endif]-->
    <!--[if !mso]> <!-->
    <table cellspacing="0" cellpadding="0"> <tr>
        <td align="center" width="300" height="40" bgcolor="#d62828" style="-webkit-border-radius: 5px; -moz-border-radius: 5px; border-radius: 5px; color: #ffffff; display: block;">
            <a href="http://www.EXAMPLE.com/" style="color: #ffffff; font-size:16px; font-weight: bold; font-family:sans-serif; text-decoration: none; line-height:40px; width:100%; display:inline-block">
                Button Text Here!
            </a>
        </td>
    </tr> </table>
    <!-- <![endif]-->
</div>
Run Code Online (Sandbox Code Playgroud)

仅在Outlook 2010和主要浏览器中测试,而不是OWA,Outlook.com或任何移动浏览器.值得仔细看看.信用到期 - http://www.industrydive.com/blog/how-to-make-html-email-buttons-that-rock/

  • 这有点肮脏,但(据我所知) - 微软产品 - 完全是解决方法.谢谢. (4认同)
  • @yAnTar:很有趣.微软声称VML已被弃用为IE9,但新的Outlook2017仍然使用VML绘制矩形,而不是自2011年以来应该使用的SVG:https://msdn.microsoft.com/en-us/library/bb263897(v = vs. 85)的.aspx (2认同)

Ben*_*ate 11

http://www.campaignmonitor.com/css/显示主要电子邮件客户端支持的所有css.圆形边框甚至没有列入清单.在页面上有一个指向完整PDF的链接,该链接指出Thunderbird 2仅支持边界半径

请注意,您必须在html元素中嵌入样式以支持广泛的电子邮件客户端

  • 是的,问题是关于Outlook.我正在看gmail,因为当我看到指南不支持时,我知道它部分是(取决于你的浏览器)让我怀疑指南是否是一个很好的参考. (5认同)

Mar*_*cel 9

我建议使用https://buttons.cm/它将生成如下内容:

<div>
  <!--[if mso]>
    <v:roundrect 
      xmlns:v="urn:schemas-microsoft-com:vml" 
      xmlns:w="urn:schemas-microsoft-com:office:word" 
      href="http://TEST.com" 
      style="height:40px;v-text-anchor:middle;width:200px;" 
      arcsize="10%" 
      stroke="f" 
      fillcolor="#B7D636">
    <w:anchorlock/>
    <center>
  <![endif]-->
      <a href="http://TEST.com"
         style="background-color:#B7D636;
                border-radius:4px;
                color:#ffffff;
                display:inline-block;
                font-family:sans-serif;
                font-size:13px;
                font-weight:bold;
                line-height:40px;
                text-align:center;
                text-decoration:none;
                width:200px;
                -webkit-text-size-adjust:none;">
              TEXT
            </a>
  <!--[if mso]>
    </center>
  </v:roundrect>
<![endif]-->
</div>
Run Code Online (Sandbox Code Playgroud)

请注意,最防弹的按钮是图像按钮。这样,整个元素将是可点击的,它将在电子邮件转发中幸存下来,并且所有电子邮件客户端都将支持它而不会出现错误。

  • 最不防弹的按钮是图像。- 许多电子邮件客户端加载不带图像的电子邮件,并提供下载图像的选项。- 链接的替代文本并不像实际按钮那样明显作为号召性用语。- 使用图像会使您面临图像链接损坏的风险,而编码按钮将始终呈现,即使并不总是采用人们可能喜欢的确切样式。- 图像会增加您的电子邮件大小。在公司层面上,这可能会减慢大规模分发的发送速度。- 按钮图像通常不被认为是理想的做法。 (2认同)

Rel*_*Rel 7

进一步@VanAlberts 回答显示了Eli Dickinson 的伟大作品。这是 Eli 的 git 仓库的链接https://gist.github.com/elidickinson/9424116

我想我会分享我对 Eli 代码的改进,该代码允许基于内部文本的动态宽度按钮。

我发现这个https://litmus.com/community/discussions/538-vml-outlook-07-10-13-unwanted-20px-padding-at-the-bottom显示了如何使用mso-fit-shape-to-text:true

这个https://litmus.com/community/discussions/1269-flexible-multi-line-bulletproof-buttons展示了如何避免一些不需要的填充。

这是我的最终结果

<div>
<!--[if mso]>
  <v:roundrect xmlns:v="urn:schemas-microsoft-com:vml" xmlns:w="urn:schemas-microsoft-com:office:word" href="http://www.EXAMPLE.com/" style="mso-wrap-style:none; mso-position-horizontal: center" arcsize="10%" strokecolor="#0368d4" strokeweight="1px" fillcolor="#d62828">
    <v:textbox style="mso-fit-shape-to-text:true">
        <center style="color:#ffffff;font-family:sans-serif;font-size:16px;font-weight:bold;">Button Text Here!</center>
    </v:textbox>
  </v:roundrect>
  <![endif]-->
  <![if !mso]>
  <table cellspacing="0" cellpadding="0"> <tr> 
  <td align="center" width="300" height="40" bgcolor="#d62828" style="-webkit-border-radius: 5px; -moz-border-radius: 5px; border-radius: 5px; color: #ffffff; display: block;">
    <a href="http://www.EXAMPLE.com/" style="font-size:16px; font-weight: bold; font-family:sans-serif; text-decoration: none; line-height:40px; width:100%; display:inline-block">
    <span style="color: #ffffff;">
      Button Text Here!
    </span>
    </a>
  </td> 
  </tr> </table> 
  <![endif]>
</div>
Run Code Online (Sandbox Code Playgroud)

在使用 word 呈现 HTML 的 Outlook 2016 中似乎效果很好