Gmail删除了"position:relative"作为内联CSS(电子邮件模板) [英] Gmail removes "position:relative" as inline CSS (Email Template)

查看:326
本文介绍了Gmail删除了"position:relative"作为内联CSS(电子邮件模板)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

据我了解,Gmail根本不接受CSS阻止,这就是为什么我一直向我的电子邮件模板添加一堆内联CSS使其起作用的原因.

From what I understand Gmail doesn't accept CSS blocks in the head at all, which is why I have been adding a bunch of inline CSS to my email template to make it work.

但是,我在CSS定位属性中苦苦挣扎.我希望图像位于背景图像的顶部,因此我将两者的父级div都设置为position: relative,并且将图像设置为绝对值.但是,由于某些原因,Gmail会从div中删除声明位置的样式属性:相对.它保留所有其他内联CSS.

However, I'm struggling with the CSS positioning property. I want an image to sit on top of a background image so I set the parent div of both to position: relative and the image to absolute. However, for some reason Gmail removes the style attribute that declares the position: relative from the div. It keeps all other inline CSS though.

有什么主意吗?有什么解决方法吗?

Any idea? Any workaround?

推荐答案

遗憾的是,我怀疑您在设计电子邮件时可能不得不放弃divs和位置的完全合理的想法.电子邮件客户端中的CSS支持是一个噩梦.

Sadly, I suspect you may have to abandon your perfectly reasonable ideas of divs and positioning when designing for email. CSS support in email clients is a tangled nightmare.

在电子邮件上强制布局的唯一(相对)肯定的方法是采用旧的学校餐桌布局,这是不幸的,但不可避免.

The only (relatively) surefire way of forcing layout on email is to go with an old school tables layout, which is unfortunate, but unavoidable.

Campaign Monitor对电子邮件客户端CSS支持的总结很出色.此处.

Campaign Monitor has an excellent summary of email client CSS support here.

这篇关于Gmail删除了"position:relative"作为内联CSS(电子邮件模板)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆