【发布时间】:2020-08-22 18:07:01
【问题描述】:
我正在尝试向我的电子邮件模板添加对暗模式的支持,但是在涉及 Outlook 时遇到了问题。由于某种原因,Outlook 部分覆盖了我的按钮的背景,这导致它显示不正确:
按钮的 HTML 如下:
<td align="center" style="word-break: break-word; font-family: "Nunito Sans", Helvetica, Arial, sans-serif; font-size: 16px;">
<a href="{{action_url}}" class="f-fallback button" target="_blank" style="color: #fff; border-color: #13c2c2; border-style: solid; border-width: 10px 18px; background-color: #13c2c2 !important; background-image: linear-gradient(#13c2c2, #13c2c2) !important; display: inline-block; text-decoration: none; border-radius: 3px; box-shadow: 0 2px 3px rgba(0, 0, 0, 0.16); -webkit-text-size-adjust: none; box-sizing: border-box;">Reset your password</a>
</td>
该按钮具有以下内联样式(为方便起见而格式化):
color: #fff;
border-color: #13c2c2;
border-style: solid;
border-width: 10px 18px;
background-color: #13c2c2 !important;
background-image: linear-gradient(#13c2c2, #13c2c2) !important;
display: inline-block;
text-decoration: none;
border-radius: 3px;
box-shadow: 0 2px 3px rgba(0, 0, 0, 0.16);
-webkit-text-size-adjust: none;
box-sizing: border-box;
此外,我已将以下内容添加到电子邮件的 <head> 部分。
<meta name="color-scheme" content="light dark" />
<meta name="supported-color-schemes" content="light dark" />
谢谢!
【问题讨论】:
-
看起来按钮没问题,但按钮内的文本可能是问题所在。文本是否包含在
<button></button>以外的其他内容中? -
@tamarin 确实如此。它包含在 元素中。
-
那么你能看到这个 元素的样式并覆盖它吗?
-
@tamarin 看起来无论我添加什么样式,Outlook 仍然会覆盖它。即使
!important似乎也无济于事。 -
!important hack 已弃用 Outlook.com 2019 年 10 月 15 日编辑:微软在今年早些时候和现在更改了暗模式的实现将 inline !important 添加到他们编辑的所有样式中。无法再覆盖 Outlook.com 的深色模式样式。
标签: html css email outlook html-email