Absolute positioning in gmail emails

放肆的年华 提交于 2019-11-28 21:02:26

Unfortunately, you can't use position: absolute.

Also, because Outlook is using the Word HTML renderer, you will also run into problems using absolute positioning.

Most HTML emails are laid out with tables.

Check this out.

I would suggest doing the whole thing as a table (div support is not 100% reliable in email clients). Use border properties to give the table the green border. Insert the image of the logo/banner in the first row of the table (merged three columns). Use the next 3 rows for the To, From and Amount (with the values in the merged second and third columns). And use the last column of the last row for the cupon code.

If you really want the double border then you can either wrap the table in a div or for maximum compatibility, wrap the table in a 1 column, 1 row table.

Yes it's ugly but email clients have extremely buggy and/or old implementations of HTML so this is not the time or place to be squirmish about ugly, non-web2.0-looking code.

See the link posted by alex for more info.

(I know I'm answering 4 years later... but probably it will help somebody...) If you look carefully, you don't have background images, you have possibly 10 images or more, many background colors and a complex table.

There's no image behind a text. You could divide your table and compose your background image as multiple image fragments, and match the text's background color with these images.

Really... in this template there are no "required" background images, just a complex table.

This did a trick for me: http://blog.rebelmail.com/absolute-positioning-in-email/

Please note that is not a foolproof solution. I had some problems with it on Outlook and need to disable it.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!