我在电子邮件中有一个按钮,当通过Outlook查看时,它的圆角边框存在问题。它不考虑我设置的border-radius和padding样式。但是,在浏览器中支持并按预期工作。是否有任何技巧可以使这些样式在Outlook中生效?
<td style="border-radius: 2px;" bgcolor="#0c6cd7">
我在电子邮件中有一个按钮,当通过Outlook查看时,它的圆角边框存在问题。它不考虑我设置的border-radius和padding样式。但是,在浏览器中支持并按预期工作。是否有任何技巧可以使这些样式在Outlook中生效?
<td style="border-radius: 2px;" bgcolor="#0c6cd7">
由于 Outlook 使用 MS-Word 模板,不支持 border-radius 属性。我们需要对 Outlook 进行编码。请查看下面的代码片段,它适用于 Outlook、浏览器以及其他电子邮件客户端。
<td>
<div>
<!--[if mso]>
<v:roundrect xmlns:v="urn:schemas-microsoft-com:vml" xmlns:w="urn:schemas-microsoft-com:office:word" href="http://example.com" style="height:36px;v-text-anchor:middle;width:150px;" arcsize="5%" strokecolor="#EB7035" fillcolor="#EB7035">
<w:anchorlock/>
<center style="color:#ffffff;font-family:Helvetica, Arial,sans-serif;font-size:16px;">I am a button →</center>
</v:roundrect>
<![endif]-->
<a href="http://example.com" style="background-color:#EB7035;border:1px solid #EB7035;border-radius:3px;color:#ffffff;display:inline-block;font-family:sans-serif;font-size:16px;line-height:44px;text-align:center;text-decoration:none;width:150px;-webkit-text-size-adjust:none;mso-hide:all;">I am a button →</a>
</div>
</td>
看起来你的按钮在 td 标签内,应该将样式应用于按钮元素而不是 td。
<td bgcolor="#0c6cd7"> <button style="border-radius: 2px;"
border-radius
样式。 - BryanH与 Outlook 无关,与您使用的元素有关。请尝试这样做:
<table>
<tr><td ><p style="border-radius: 2px; background:#0c6cd7">test</p></td></tr>
</table>
或者您可以使用单独的CSS,但这可能会影响其他样式:
table tr td {
border-radius: 2px;
display: block;
background:#0c6cd7;
}
<table>
<tr><td >test</td></tr>
</table>