Doctype, <html>, <meta> and <title> boilerplate:
Notes: Set to 'xhtml1-strict' as this is what GMail automatically uses so we'll have better results if we restrict out HTML development to it.. with a few exceptions.
Using meta tags to set the 'content type' doesn't really have any effect, as clients use the content type that is set in the email's header by the email server. Best bet is to replace any special characters with the HTML entity.
The 'format-detection' meta tag turns off iOS devices automatically detecting phone numbers and turning them into URLs. This is preferable as it will keep the text in the desired style, rather than turning it bright blue with an underline. iOS will also do this with 'dates' and with 'postal addresses', but there is no meta tag to switch off this feature. Instead you must turn them into a non-functional link:
<body>
Should not have any styles applied to it directly, as styles on this tag are technically not allowed in xhtml1-strict, they are ignored by some clients and other clients remove this tag all together. Use embedded CSS (see below) to apply styles to the <body>.
CSS
Other than this use Inline CSS, no External Stylesheets. You can develop and email using Internal Styles and then run it through http://premailer.dialect.ca/ to convert them to Inline. Copy any Embedded CSS to the bottom of the email as well, inserting it before the </body> tag so that Yahoo in IE7/IE8 will pick them up.
Avoid using CSS shorthand.
CSS support of email clients that we support:
Text & Fonts | font font-family font-style font-variant font-size* font-weight letter-spacing line-height** text-align text-decoration text-indent text-transform |
Color & Background | color background-color HSL Colors (CSS3) |
Box Model | border margin*** padding**** width**** |
Tables | border-collapse table-layout |
* iOS devices will auto-resize copy to a minimum size of 13px. To stop this:
** Outlook may not support; add 'mso-line-height-rule:exactly' before 'line-height'. For Outlook '07 the line-height must be no smaller than the font-size, or the text will not render at all!
*** Hotmail doesn't support 'margin' or 'margin-top'
**** Outlook '07/'10 doesn't support padding in <p> or <div>
Use web safe fonts.
If there is copy in the email layout which does not use web safe fonts, it will have to be displayed in the email using image files or require a design revision.
Is there a web-safe Helvetica Neue CSS font-family stack?
JavaScript
No.
Use tables for layout, not styled divs or spans. Usually you'll want to set the padding, spacing and borders of the table to zero and collapse the borders of the table and it's td.