Table Cell background image with text over it - Outlook - Gmail


I recently read one of the posts on here

and also this one:

explaining how I could use a simple bit of code to get background images to show correctly in my email templates.

The problem being that Outlook 2007 and Gmail seem to strip out the 'background-image' code. So this fix was supposed to make the image display properly in these clients.

Here is the code I am trying...

<html xmlns:v="urn:schemas-microsoft-com:vml">
v:* { behavior: url(#default#VML); display: inline-block; }
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<title>Untitled Document</title>
</head><body><table width="0" border="0" cellspacing="0" cellpadding="0">
    <td  background="" width="590" height="151" >
    <!--[if gte vml 1]> <v:image style='width: 590px; height: 151px; position: absolute; top: 0; left: 0; border: 0; z-index: -1;' src="" /><![endif]-->

Can anyone tell me what I'm doing wrong? The thread is full of comments saying it works but I cant see where Im going wrong?

Any help would be greatly appreciated!



JohnP JohnP, 5 years ago

try putting width="100%" and move the background="" to your <table> tag instead of the <td>.

I stripped out all the other tags, but this works for me:

<body style="background-image: url('img');">
<table width="100%" background="img">

Hope that helps

See why 200,000 companies worldwide love Campaign Monitor.

From Australia to Zimbabwe, and everywhere in between, companies count on Campaign Monitor for email campaigns that boost the bottom line.

Get started for free