Explain Codes LogoExplain Codes Logo

Best Practices & Considerations when Writing HTML Emails

html
responsive-design
email-design
best-practices
Alex KataevbyAlex Kataev·Jan 14, 2025
TLDR

To optimize HTML emails, use inline styles and table-based layouts. Maintain a content width of 600px for desktop readability, and implement responsive design for mobile displays. Choose web-safe fonts for uniform text across clients, and always include a text-only version. Before send-off, employ Litmus or Email on Acid to ensure multi-client compatibility.

<!-- Minimalistic but chic HTML email setup --> <table width="100%" cellpadding="0" border="0"> <tr> <td> <table width="600" align="center" cellpadding="0" border="0" style="font-family: Arial, sans-serif; color: #333;"> <tr> <td> <!-- The spotlight is yours! --> Main content here </td> </tr> </table> </td> </tr> </table>

Remember to use inline CSS due to email-client peculiarities and avoid JavaScript - it's a no-go zone in most email clients. Managing images in Hotmail and background images in Outlook requires special attention, utilizing 'display:block' styling and VML, respectively.

Building Stable Layouts: Tables over Divisions

Channeling 2000s Web Development

Produce stable layouts using nested tables, a throwback to the early era of web development. Compose layouts the same way you did in the '00s — with nested tables.

Embracing Mobile Responsiveness

Use media queries for crafting a mobile-friendly design. Think of every table cell as a flexible module contributing to an overall fluid layout. Yahoo Mail's media query bug can be resolved by applying inline mobile styles.

Handling Images

Always provide alt text for images for better accessibility. For good ol' Outlook, use VML for background images. Avoid unpredictable spacing in platforms like Hotmail with the 'display:block' property for images.

Email Clients Chemistry: Understanding the Differences

Email Clients: The Good, The Bad & The Ugly

Consult CSS support guides to handle the wide variety of email clients out there—some friendly, others, not so much. For example, Outlook requires special attention, sometimes needing VML to keep styling consistent.

Troubleshooting Client-Wise Quirks

A necessary part of HTML email design involves dealing with peculiarities, like Yahoo's Media Query bug and Outlook's conditional CSS. But hey, challenges make life interesting, right?

Using Collective Wisdom

There are fantastic resources available from Campaign Monitor and Mailchimp. These platforms provide templates, guides, and advice to enable you to expertly navigate the world of HTML emails.

Mastering HTML Emails

Using the Right Tools

Have CSS inlining tools at your beck and call to easily adapt to the quirks of HTML email design. Test with Litmus or Email on Acid for more reliable results before sending out the email.

Thinking Outside the (In)box

For the sake of your mobile readers, consider fluid mobile designs, giving your emails the versatility they need to shine on any screen.

Web Fonts: A Dream or a Nightmare?

While web fonts are tantalizing, they might be a fever dream in the world of emails. Your safe bet is sticking to web-safe fonts, but if you're feeling adventurous, ensure there's a fallback font at the ready.