Best practices for styling HTML emails
Craft HTML emails utilizing the power of inline CSS and good old table-based layouts to ensure cross-client compatibility. Choose web-safe fonts over the fancier ones and streamline your CSS. Introduce media queries for responsive design in email clients that support it. Fear the JavaScript and complex CSS - they can break in email environments.
Remember to use <!DOCTYPE html>
and <meta charset="utf-8">
for consistent results and sweet sweet Unicode support. For our buddy Outlook, wrap CSS styles in <!--[if mso]>...<![endif]-->
conditional comments.
The art of hyperlinking in emails
Craft your hyperlinks with precision. Always go full monty with absolute URLs. Be wary of your display text for links; long URLs can go on a rampage and break your layout. Neatly wrap URLs in <a>
tags and use inline styles to maintain your artistic control over their presentation.
Images: the good, bad, and the ugly
Embed your images in your emails using cid:
, they can act like the good neighbors who don't visit unannounced, skipping the awkward external server downloads. Be kind to Outlook with fallbacks using <!--[if mso]>
fearsome conditional comments. Optimize your images by reducing color depth so they lose weight without losing their charm.
Compatibility is key, testing is the door
Take your styled HTML email for a tour across different email clients using the tour guides like Litmus or MailChimp's Inbox Inspector. With the Campaign Monitor support matrix as your roadmaps, avoid the roads less travelled by unsupported features.
The media query magic trick
Involve media queries in your act to target specific unicorns (devices) or screen resolutions, making your show responsive. However, be mindful that not all guests (email clients) enjoy this kind of magic, hence, the old rabbit-in-the-hat trick (fallbacks) might still be needed.
Honing your inliner skills
Inline styles are your good habits that prevent a lot of "Why did I do it?" moments caused by client variations. Tools like Premailer are the cheat sheets that automate the process, because we don't make mistakes, we make happy little accidents.
Building emails, one table at a time
The unassuming <table>
provides the backbone while properly nested <td>
elements toned with inline styles form the muscles of your email body. Together, these buffed elements are ready to flex across a range of email clients.
Was this article helpful?