Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

Setting a background color for an HTML email message

Wrapper table

There are different ways to set the background color for an HTML message. One is to create a wrapper table with that background color, like this:

...

  • It leaves a small, white border around the message in some email clients
  • It can create a problem in Outlook (2007, 2010) when the message height exceeds 23 inches, if you set the table width to 100%. If you don't, then there might be some white space at the botton of the message.

Style in BODY tag

As email clients are getting better at handling the <HEAD> and <BODY> tags, you can also set the background color by placing a bit of HTML code inside the BODY tag of the message.

...

This method gets rid of the two issues mentioned above for the wrapper table, but is still affected by lack of support in some email clients.

Combining both methods

For best results, the safest way to go is to use both of these methods at the same time. They do not conflict. So...

...