Html – What guidelines for HTML email design are there?

emailhtml

What guidelines can you give for rich HTML formatting in emails while maintaining good visual stability across many clients and web based email interfaces?

An unrelated answer on a question on Stack Overflow suggested:

http://www.campaignmonitor.com/blog/archives/2008/05/2008_email_design_guidelines.html

Which contains the following guidelines:

  1. Place stylesheet in <body> instead of <head>
    Some email clients will strip CSS out of the head, but leave it if the style block is (invalidly) in the body.
  2. Use inline styles where ever possible
    Gmail will strip any stylesheet, whether in the <head> or in the <body>, but honor inline styles assigned using the style="" attribute
  3. Return to tables
    Email standards have actually taken a giant step backwards in recent years thanks to Outlook 2007 using the Microsoft Word rendering engine. Unlearn most of what you learned about positioning without stylesheets.
  4. Don't rely on images
    Most clients and most web based email clients will not display images unless the user specifically requests them to be displayed.

I also have a few "unconfirmed" truths that I don't remember where I read them.

  1. Don't use more than two levels of nesting in tables
    Is this true. What is likely to happen if I do? Is there any particular client/clients that choke on this?
  2. Be careful of nesting background images in cells/tables
    As I understand you may encounter situations where the background image is applied in the descending table/cell completely anew, and not just "shining through". Again, true or not? Which clients?

I would like to flesh out this list with more guidelines and experiences from the trenches.

Can you offer any further suggestions?

Update: I'm specifially asking for guidelines for the design part in HTML and consistency there of. Questions about general guidelines for avoiding spam filters, and common courtesy are already on SO.

Best Answer

It's actually really hard to make a decent HTML email, if you approach it from a 'modern HTML and CSS' perspective.

For best results, imagine it's 1999.

  • Go back to tables for layout (or preferably - don't attempt any complex layout)
  • Be afraid of background images (they break in Outlook 2007 and Gmail).
  • The style-tag-in-the-body thing is because Hotmail used to accept it that way - I'm pretty sure they strip it out now though. Use inline styles with the style attribute if you must use CSS.
  • Forget entirely about float
  • Remember your images will probably be blocked - use background and text colour to your advantage - make sure there is some readable text with images disabled
  • Be very careful with links, be especially wary of anything that looks like a URL in the link text - you will anger 'phishing' filters (eg <a href="http://domain.tld">www.someotherdomain.tld</a> is bad)
  • Remember that the "fold" on webmail clients tends to be extremely high up the page (on a 1024x768 screen, most interfaces won't show more than a hundred pixels or so) - get your identity stuff in right at the top so the recipient knows who you are.
  • Recent version of outlook have a "portrait" preview pane which is significantly narrower than you may be expecting - be very wary of fixed-width layouts, if you must use them, make them as narrow as you can.
  • Don't even think about flash, Javascript, SVG, canvas, or anything like that.
  • Test, a lot. Make sure you test in a recent Outlook (things have changed a lot! It now uses Word as its HTML rendering engine, and it's crippled: Word 2007 HTML/CSS support). Gmail is pretty finicky also. Surprisingly Yahoo's webmail is extremely good, with nice CSS support.

Good luck ;)

Update to answer further questions:

Don't use more than two levels of nesting in tables

I believe this is an older guideline pertaining to Lotus Notes. Nested tables should be okay, but really, if you have a layout that's complicated enough to need them, you're probably going to have trouble anyway. Keep your layout simple.

Be careful of nesting background images in cells/tables

This may be related to the above, and the same applies, if you're getting that complicated then you will have problems. Recent versions of Outlook don't support background images at all, so you'd be best advised to forget about them entirely.