Gmail www。 vs. ios和背景剪辑:文本; CSS属性
我正处于设计HTML电子邮件的过程中,其目的是在电子邮件客户端和光/黑暗模式之间完全兼容。
我在这个设计系统方面取得了很多进展,但是我遇到了Gmail正在以不同方式处理代码的问题。
这就是在黑暗模式下通过Gmail iOS渲染的内容。 example-1
这就是通过desktop web-browser渲染的内容。 xameame-2
问题: 看来背景纸条:文本;仅由Web应用程序没有的iOS应用程序支持。 颜色是作为背景颜色生成的,然后文本应夹紧背景以显示颜色作为文本的颜色。这对于将可读性保留在黑暗模式下是必要的,否则该类型与我们的品牌颜色的背景融为一体。
此方法仅对于Gmail来说是必要的,因为其他电子邮件客户端似乎没有任何问题。
文本的CSS专门针对Gmail,看起来像这样:
u + .body .gmail-text {
background-color: #E8DDD9;
background-image: linear-gradient(90deg, #E8DDD9, #E8DDD9);
background-size: 100%;
background-repeat: repeat;
color: transparent!important;
background-clip: text;
-webkit-background-clip: text;
-webkit-text-fill-color: transparent;
-moz-background-clip: text;
-moz-text-fill-color: transparent;
}
所以我的问题; 是否有人想出了一种解决方案来真正定义Gmail的深色模式中的文本颜色? 有没有一种方法可以开发此问题,以便可以将工作解决方案仅应用于Gmail iOS,如果客户端是浏览器访问Gmail的情况,则可以应用一组单独的属性?
非常感谢您的帮助!
I am in the middle of designing an HTML email, with the goal of it being fully compatible across email clients and light/dark mode.
I have made a lot of progress with this design system but I am running into issues where Gmail is handling code differently depending on how one accesses this.
This is what is rendered through Gmail iOS in dark mode, as it should look.
example-1
This is what is rendered through Gmail through a desktop web-browser:
example-2
The problem:
It seems that the background-clip: text; is only supported with the iOS app where the web app isn't.
The color is generated as a background color where the text should then clip the background to present the color as the color of the text. This is necessary to retain readability in dark mode, otherwise the type blends far too much with the background which is our brand color.
This method is only necessary for Gmail as other email clients do not seem to have any problem with these.
The CSS for text targets Gmail specifically and looks something like this:
u + .body .gmail-text {
background-color: #E8DDD9;
background-image: linear-gradient(90deg, #E8DDD9, #E8DDD9);
background-size: 100%;
background-repeat: repeat;
color: transparent!important;
background-clip: text;
-webkit-background-clip: text;
-webkit-text-fill-color: transparent;
-moz-background-clip: text;
-moz-text-fill-color: transparent;
}
So my questions;
Has anyone figured out a solution to truly defining text color in gmail's dark-mode?
Is there a way to develop this so that the working solution can be applied to ONLY Gmail iOS, where if the client is a browser accessing Gmail a separate set of attributes can be applied?
Thanks so much for your help!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
根据“ 如何针对电子邮件客户端”,以下CSS目标Gmail iOS(10+)具体:
@supports(-webkit-overflow-crolling:touch)和(color:#ffff){.foo}
,因为它已经针对Gmail ios,您可以重新写入您的代码为:
According to "How to Target Email Clients", the following CSS targets Gmail iOS (10+) specifically:
@supports (-webkit-overflow-scrolling:touch) and (color:#ffff) { .foo }
Since it already targets only Gmail iOS, you could rewrite your code as: