旧版Outlook(2405)邮件按钮<a>标签宽度与样式适配问题
邮件按钮在旧版Outlook(2405)中的适配问题
我需要在邮件模板里实现一个特定样式的按钮,要求a元素填满td元素,让整个红色区域(td背景)都能点击(蓝色边框是a元素)。这个效果在新版Outlook里显示正常,但旧版Outlook(2405)出现以下问题:
a元素宽度无法填满td元素;- 链接可点击区域跑到边框左侧外部,右侧却不能点击;
span内的文本不是白色,而是默认链接颜色,点击时还会变色。
初始代码
<table> <tr> <td align="center" style=" background: red;"> <a href="https://google.com" target="_blank" style=" border: 3px solid blue; text-decoration: none; display: block; color: white; text-transform: uppercase; padding: 30px 0; font-weight: 700; font-size: 14px; width: 100%; box-sizing: border-box; cursor: pointer; letter-spacing: 0.0625em;"> <span> MY BUTTON </span> </a> </td> </tr> </table>
我试过把inline-block改成block、调整宽度、给文本颜色加!important,也参考过相关解决方案,但都没用。
最终可用代码
<table> <tr> <td align="center" style=" background: red;"> <a href="https://google.com" target="_blank" style=" border: 3px solid blue; text-decoration: none; display: block; text-transform: uppercase; padding: 30px 0; font-weight: 700; font-size: 14px; box-sizing: border-box; cursor: pointer; letter-spacing: 2px;"><!--[if mso]><i style="mso-font-width:245%;" hidden>    </i><span><![endif]--> <span style="color: rgb(255,255,255) !important"> MY BUTTON </span> <!--[if mso]></span><i style="mso-font-width:245%;" hidden>    ​</i><![endif]--> </a> </td> </tr> </table>
目前这个方案已经满足需求。
内容的提问来源于stack exchange,提问作者tiny_mike
相关产品推荐
相关产品推荐

