This page is not available in every language. Missing translations are disabled in the language selector.

Quick reference

HTML Email Template Cheatsheet

A quick reference guide for HTML email styling: table layouts, client quirks (Outlook, Gmail), unsupported CSS selectors, and responsive techniques.

· Published

HTML email development requires defensive, table-based layouts to render reliably across desktop and mobile email clients (Outlook, Gmail, Apple Mail, Yahoo).

Client Quirks & Disallowed CSS

Properties to Avoid

Property & Scope Problematic Clients Safe Alternative
width on <p> or <div> Microsoft Outlook Specify width on <td> elements
padding on <p> or <div> Microsoft Outlook Apply padding on <td> cells
margin (all forms) Outlook, Hotmail Use spacing table cells
background-image Outlook Windows desktop Use Microsoft VML tags
data-uri images Webmail clients Host images on external HTTPS CDN

Selectors to Avoid

Selector Type Problematic Clients
Pseudo-elements (::before, ::after) Outlook, Yahoo, Gmail
Adjacent / sibling selectors (E + F, E > F) Outlook, Gmail App
Attribute selectors ([href^="https"]) Older webmail clients

Rule of thumb: Always inline all CSS into style="..." attributes on table cells.

Foundational Layout Boilerplate

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
  "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
  <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
  <meta name="viewport" content="width=device-width, initial-scale=1.0"/>
  <title>Responsive Email</title>
  <style type="text/css">
    @media only screen and (max-width: 600px) {
      .container { width: 100% !important; }
    }
  </style>
</head>
<body style="margin: 0; padding: 0;">
  <table border="0" cellpadding="0" cellspacing="0" width="100%">
    <tr>
      <td align="center" style="padding: 20px 0;">
        <table class="container" border="0" cellpadding="0" cellspacing="0" width="600" style="border-collapse: collapse;">
          <tr>
            <td style="color: #333333; font-family: Arial, sans-serif; font-size: 16px; line-height: 24px;">
              Email content goes here.
            </td>
          </tr>
        </table>
      </td>
    </tr>
  </table>
</body>
</html>

References

Related topics