Adding background images to email? We’ve already done the hard work for you. Check out Stig’s ‘Bulletproof Email Background Images’ code generator at emailbg.net
Also, a more elegant and up-to-date method for displaying background images can be found here.

We often get asked about the best way to add a background image to an email newsletter. Well, the good news is that there’s a reliable way to get a repeating background image to surround your content in most major email clients, including Gmail and Outlook 2007! In this post, we’ll walk through two techniques which can be combined to give your design some background image love.
table attribute approachLook, I’ve written some darn ugly code in my time, but I still get itchy when I use tables. In so much as we shy from them, it should come as no surprise to you folks at home that a fair few table attributes are fairly well supported by the major email clients… And in particular, background.
So, the first thing you can do is to wrap your newsletter content in a table of width="100%", so it spans the width of the reading pane. Then, add the attribute, background="background_image.png" and it should all be roses. Here’s how:
<table width="100%" border="0" cellspacing="0" cellpadding="20" background="background_image.png">
<tr>
<td>
<p>Content on a pretty background image.</p>
</td>
</tr>
</table>
So far so good. The table will expand downwards as you add more content, so a repeating background image will tile just nicely until the end of your email.
The good news is that this works in most major email clients, including Gmail. Notable exceptions are Outlook 2007 and 2010, plus Lotus Notes 6 and 7.
Not wanting to keep the ever-demanding Outlook 2007 and its relation, Outlook 2010 away from the action, we turned to a crafty technique for getting background images to work in Outlook 2007. The code looks something like this:
body {
background-image: url('background_image.png');
background-repeat: repeat-y no-repeat;
background-color: #333;
margin: 0;
padding: 0;
}
Surprisingly enough for a CSS solution, this does the trick in Outlook 2007 et al. The main difference between this approach and using table attributes is that in some email clients, the background image will extend the entire height of the reading pane, instead of simply the height of the email. However, unless you have a fairly short email (less than the height required for the scrollbar to kick in), you won’t be able to tell the difference.
I’ve also had it pointed out that using the background attribute in the body tag works in a similar fashion. Unfortunately, it doesn’t seem to display a background image in Outlook XP. Considering you have to use some CSS anyway (see below), you might as well stick to our CSS approach.
So are you thinking what I’m thinking?
By using both the table attribute and CSS styles in your HTML email, you pretty much have the entire spectrum of major email clients covered. Don’t forget to set margin: 0; padding: 0; in body (as above) - otherwise your table background image won’t be flush with the image defined in your CSS styles.
And finally, if you’re really finicky, you can define a fallback color for Lotus Notes 6 & 7 by using, <body bgcolor="#333"> (where #333 is the color of your choice). If you’ve already defined a fallback background-color using CSS, then this will only display in these earlier versions of ‘Notes.
Well, that’s background images in the bag. Many thanks to Stephen for the awesome tip and staying up late to give us first-hand World Cup updates. Let us know below if you have any questions, or have been using a similar alternative!
24th June
Damn, you guys have discovered me long held secret!
24th June
I’d given up on backgrounds in email - thanks very much for posting this.
24th June
What does this do for the size of the email though?
24th June
Thanks for posting guys.
@chris - no more than adding any other image - what are you getting at? And technically, the size of the email isn’t affected as the images are downloaded from the server. If someone doesn’t want images, they don’t have to turn them on.
24th June
But would this work if it were to be applied inside a cell with text in it?
24th June
This is awesome info. Thanks!
24th June
Funny to see the CSS solution and not the HTML one work in Outlook :)
24th June
Does it matter where you place the css for the
styles, or do you just add an inline <pre><style></pre> tag and place the css it in that? I know that some email clients strip out the <pre><head>/pre> section.
24th June
This is great news when you want the attribute applied to the entire background. My main hurdle is getting it to work for side borders alone. It still appears as though Outlook wont accept classes for background images, only body. Has anyone had any success with this?
24th June
Caleb - Unfortunately, this doesn’t seem to work as well when applied to individual table cells. In particular, Windows 07/10/Mail just won’t play nice.
27th June
great post….
i am not much of “table” user,but when it comes to e-mailer(specially for outlook) i always use them…
27th June
I almost never use tables for web pages .... but when it comes to email they solve a lot of problems. Great post ! Thanks.
27th June
Nice tip.. using ugly old style HTML and CSS in email works always better.
27th June
The only way I’ve been able to get background images to render in email is to reference the image via url(‘http://domainname.com/imagename.gif’) for example. Otherwise how does the recipient reference the image; it’s not like it get’s attached automatically - right?
28th June
Hi Bravo, Campaign Monitor hosts any images that you upload during the campaign import process and updates your links accordingly to reflect this. So background-image: url(‘background_image.png’); is fine, as long as you zip up background_image.png and import it as well.
29th June
Hi, tried but still not working :( Outlook 2007 cleans up the body tag and marks out style tag. Outlook source below. Do you have any fix for it?
// original html //
<!DOCTYPE HTML PUBLIC “-//W3C//DTD HTML 4.01 Transitional//EN”>
<html lang=“en”>
<head>
<meta http-equiv=“Content-Type” content=“text/html; charset=utf-8”>
<title>Newsletter</title>
<style>
body {
background-image:url(‘www.mydomain.com/bg.gif’);
background-repeat:repeat-y no-repeat;
background-color:#ffffff;
margin:0;
padding:0;
}
</style>
</head>
<body border=“0” topmargin=“0” leftmargin=“0”>
<table width=“100%” cellpadding=“0” cellspacing=“0” border=“0” bgcolor=”#ffffff” background=“www.mydomain.com/bg.gif”>
..
// Outlook 2007 source //
<html><head></head><body><meta http-equiv=“Content-Type”
content=“text/html; charset=utf-8” />
<title>Newsletter</title>
<style><!—
body {
http://www.mydomain.com/http://www.mydomain.com/http://www.mydomain.com/bg.gif’);
background-image:url(http://www.mydomain.com/bg.gif’);
background-repeat:repeat-y no-repeat;
background-color:#ffffff;
margin:0;
padding:0;
}
—></style>
<table background=“http://www.mydomain.com/bg.gif” bgcolor=”#ffffff”
border=“0” cellpadding=“0” cellspacing=“0” width=“100%”>
..
29th June
Great job in summing it all up for us. I’ve always used table in email designs, and I still see that this (old) technique have its uses for some email clients.
In any cases, thanks for sharing the tests you made.
29th June
will an inline style work as well as attaching the css in the header?
30th June
@veiko Try putting http:// in front of your image url and see if that works.
30th June
Wow, I never knew you could add the background attribute directly to the table tag, i will have to try this out today.
30th June
Adding images and table to your email newsletter is nice, but unfortunately the recipients spam software will still kick it out because of base64 and being able to detect that it is an html doc
30th June
It doesn’t work for me either. Even with http:// in front of the image ref.
30th June
Please provide your code, this is not working for me?
30th June
@Veiko - another trick we’ve picked up is that some emails strip out style code in the head section. Generally we put our style declarations below the body tag (seems to be greater support for this). Dunno… might help you, might not!
30th June
Dan & Frederick - Check out this basic sample newsletter - hopefully the source code will give you some pointers to get it working.
Diane - yes, it should. By default, Campaign Monitor moves your styles inline upon import of your email.
Tony - we haven’t come across any particular spam filter issues with using this technique. It doesn’t use base64 encoding, just plain-jane HTML/CSS.
Thank you, everyone! We’ve been loving the feedback from all of you, so keep being awesome. Happy emailing!
30th June
Thanks Ros
It seems that bg image needs to repeat-y. Without this attribute it doesn’t work. What if I want to use only one image and don’t repeat it?
30th June
Hi Dan, yep, that’s spot on. Unfortunately, I’ve tried using one, non-repeating image and it doesn’t seem to work. If you use background-repeat: no-repeat; the background image doesn’t display in Outlook ‘07.
So, it’s a repeating background or nothing, it seems. Or potentially, you can use a helluva big image…!
30th June
Hi Ros
I don’t really want to do massive BG image because of mobile device users. I’m trying to get to the bottom of this and I will let you know as soon as I find solution to this
30th June
Great tip!
I put all my CSS inline and I’ve also heard that I should only put in the mail what’s inside the <body> tag because clients don’t consider the <head> and <title> and all that anyway. If I use this approach do I just put the <style></style> above my html or is that bad?
So it’s:
<style>
MY CSS
</style>
<table>
MY CONTENT
</table>
1st July
Hi Ros, I’ve tried copy and paste the sample code but it doesn’t work for me in Outlook 07(the html email only display the background color). The background image I’m using is saved on a web server and I’m using a absolute path to link to it (e.g. http://www.dominname.com/imgs/bgImg.png). I was wondering if there is any requirement for the location of the background image?
Thanks a lot for your help!
1st July
Does the CSS only work on the body tag in 07, or can this be applied to any element (eg the table element)?
Cheers.
1st July
@Jess - A lot of email clients do have the habit of stripping <head> tags. However, Campaign Monitor moves a copy of your styles inline by default, so this isn’t such an issue. Your approach is valid, too, as is just making your styles inline when coding your email :)
@Vincent - Very interesting. Your example should work, as the app assigns an absolute link to all images imported with your HTML email (ie. we host ‘em), then uses this link in your campaigns. Could you kindly send an email with your code (including a link to your image) to support [at] campaignmonitor.com, addressed to me? I’ll certainly take a look into it.
@Aaron - Sadly, it only seems to work with the body tag in ‘07.
2nd July
Hi Ros,
I pasted your code, I gave the image the correct path
background-image: url(http://www.campaignmonitor.com/downloads/bg-image-sample/grey_stripe.png);
But it still does not work in Outlook 07.
I am sorry to ask, and I do not mean any disrespect… but can anyone else test this and give their comments? This is a big deal if it does work.
3rd July
It’s too bad this only works on the body of the email and not within nestled tables. Either way, it’s useful! Thanks, Ros!
3rd July
As many have posted on here already, please keep in mind this is for the background “body” of the entire e-mail.
The body tag and a 100% table are used to double up the effort of creating the tile/repeating background.
The next level down, however, is your centered nested table containing your content. This is where incompatibilities exist, and pitchforks are raised at Microsoft.
6th July
hi does this only work in the body tag? I can’t get it to work in a table cell.
6th July
ah just read the comments this won’t work in table cells :(
6th July
Update: There’s also an alternative method that works with individual table cells. Check it out here. We’d love to hear any feedback you have regarding this!
7th July
Hi Ros, I tested their example and the background image does not show up in Outlook 03 or 07. I am having a hard time believing this has been tested. PLEASE help? I would love this to really work.
7th July
Hi Frederick, so both this method and Brian’s new method aren’t working for you, when tested on a desktop email client (ie. not the design & spam tests)? Hmm, you might want to check your security settings to ensure that images are being downloaded.
As above, kindly send an email with your code (including a link to your image) to support [at] campaignmonitor.com - address it to me and I’ll certainly take a look into it. Alternately, we might be able to help you via Brian’s thread on the forums.
13th July
For those who had issues when using the background image fix and background colors (colors were trumping images), there’s a fix now posted on the thread mentioned by Ros.
29th July
Thank you very much - this solution works quite well when displaying background images in Hotmail and Live mail! Now my html emails display in Outlook (not all versions tested though…), Outlook Express, Hotmail, Windows Live, Thunderbird, and Gmail.
30th July
This is a great help, much appreciated CM! :)
4th August
Just posted the fruit of an experiment with background-image on the CM forum
http://www.campaignmonitor.com/forums/viewtopic.php?pid=14683#p14683
Let me know what you think good people :)
1st September
Great stuff