简体   繁体   English

HTML电子邮件的特定于平台的CSS

[英]Platform-specific CSS for HTML emails

I'm using negative margin values for an HTML email, which is admittedly a tricky issue. 我为HTML电子邮件使用了负的页margin值,这无疑是一个棘手的问题。 However, most of my email list is on OSX or iOS, so it's worth it. 但是,我的大多数电子邮件列表都在OSX或iOS上,因此值得这么做。 On the other hand, some of my list is on Gmail, where negative margin values get stripped. 在另一方面,我的一些列表在Gmail,其中负margin值获得剥夺。 Instead of using a negative margin for my Gmail audience, I'm wanting to center that element instead. 我不想将Gmail受众群体的margin设为负数,而是希望将元素居中。 Is there a way to write CSS specifically for Gmail (or any other platform)? 有没有一种方法可以专门为Gmail(或任何其他平台)编写CSS?

Example code for Apple products: Apple产品的示例代码:

.cmt_new img {margin-bottom: -55px; position:relative; z-index:1;}

在此处输入图片说明

Desired outcome for Gmail: 所需的Gmail结果:

在此处输入图片说明

One thing I can suggest, is to write a code that: 我可以建议的一件事是编写以下代码:
Works for the first email client (the not gmail one), and would look good, if you were to take out the piece that's not supported by gmail. 适用于第一电子邮件客户端(未Gmail的一种), 会很好看,如果你拿的是不是由Gmail的支持片。
Basically you'd make a unique document work for both. 基本上,您会为两者创建一个唯一的文档。
How? 怎么样?
By finding out exactly which codes Gmail doesn't support, you will be able to make a design, with in mind the fact that certain codes won't count. 通过准确找出Gmail不支持的代码,您将可以进行设计,同时要记住某些代码将不起作用。

Something like: 就像是:

A = is a code that's supported by all (including gmail). A =是所有人(包括gmail)都支持的代码。
B = is a code that's not supported by gmail. B =是gmail不支持的代码。

Code: 码:

< A >Hello< A > < B > everyone < B > <A>你好<A> <B>每个人<B>
< A > and welcome < A > <A>并欢迎<A>

Result on emails: Hello everyone and welcome. 电子邮件结果:大家好,欢迎光临。
Result on gmail : Hello and welcome. gmail上的结果:您好,欢迎您。

Get it? 得到它?

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM