Snelle referentie

HTML E-mailtemplates Spiekbrief

Een snelle gids voor HTML-e-mails: tabel-layouts, eigenaardigheden van Outlook en Gmail, niet-ondersteunde CSS-selectors en responsive technieken.

· Gepubliceerd

Ontwikkeling van HTML-e-mails vereist defensieve, tabelgebaseerde layouts om betrouwbaar te renderen op desktop en mobiel.

Client-eigenaardigheden en verboden CSS

Te vermijden eigenschappen

Eigenschap en bereik Problematische clients Veilig alternatief
width op p of div Microsoft Outlook width specificeren op td-elementen
padding op p of div Microsoft Outlook padding toepassen op td-cellen
margin (alle vormen) Outlook, Hotmail Tabelcellen als afstandhouders gebruiken
background-image Outlook Windows desktop Microsoft VML-tags gebruiken
data-uri afbeeldingen Webmail clients Afbeeldingen hosten op externe HTTPS-CDN

Te vermijden selectors

Selectortype Problematische clients
Pseudo-elementen (::before, ::after) Outlook, Yahoo, Gmail
Aangrenzende selectors (E + F, E > F) Outlook, Gmail App
Attribuutselectors ([href^="https"]) Oudere webmail-clients

Vuistregel: Pas alle CSS altijd inline toe in style="..."-attributen op tabelcellen.

Basis Responsive E-mail Sjabloon

<!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;">
              E-mailinhoud komt hier te staan.
            </td>
          </tr>
        </table>
      </td>
    </tr>
  </table>
</body>
</html>

Referenties

Verwante onderwerpen