Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Gmail HTML email background

I'm working on an HTML email. The problem I get is that GMAIL doesn't use the "background-position" i give it. I have a table with 100% width that has a background that has to be centered. Most clients do this perfectly but Gmail doesn't. Is there a workaround for this?

The inline CSS is like this: (i've split all the background properties up because otherwise most clients don't display it the right way)

<table style="background-repeat: no-repeat; background-position: center top;" border="0" width="100%" align="center" bgcolor="#1E1411" background="assets/mainback2.jpg">
like image 948
jwktje Avatar asked Mar 19 '12 09:03

jwktje


2 Answers

It IS possible, you simply have to put all the background style in one line, like so:

background:#1E1411 url(assets/mainback2.jpg) no-repeat center top;

But because some email clients can't handle background images you have to separate the colors.

background:url(assets/mainback2.jpg) no-repeat center top;
background-color:#1E1411;
like image 118
ognockocaten Avatar answered Sep 28 '22 07:09

ognockocaten


You answered your own question.

GMAIL doesn't use the "background-position

article

like image 44
Damian Avatar answered Sep 28 '22 07:09

Damian