HTML Email Templates: The Constraints That Have Not Gone Away
A practitioner’s guide to html email template coding in 2026: Outlook’s Word engine, fluid hybrid responsive email tables, dark mode hacks and Gmail’s 102KB
A client forwarded us a screenshot last year with the subject line “this is broken”. Their 600px campaign was rendering at 750px in Outlook 2019, cropping the right edge of every button. Nothing was broken. The machine was set to 120 DPI, Outlook’s Word engine scaled every pixel value by 1.25, and the fix was nine lines of XML in the <head> that have been required since roughly 2007.
That is the state of html email template coding in 2026. The web moved on: container queries, cascade layers, :has(), view transitions. Email got a Chromium-based Outlook, slightly better dark mode signals, and that is about it. The constraints that defined email development a decade ago are still the constraints. The developers who ship reliable email are the ones who stopped waiting for that to change.
This is not a case for giving up on quality. It is a case for knowing exactly which rules still bind you, which have genuinely loosened, and where the remaining budget of effort should go.
- Classic Outlook for Windows still renders with the Word engine and Microsoft has committed to supporting it until at least 2029, so MSO conditional comments, ghost tables and VML buttons are not legacy cruft yet.
- The fluid hybrid (spongy) pattern beats media-query-only responsive email tables because the Gmail Android app strips
<style>entirely when the account is a non-Gmail IMAP account, which is common on B2B lists. - Gmail clips messages larger than 102KB of HTML, which also cuts off your tracking pixel and unsubscribe link. Minify, dedupe inline styles, and check the byte count in CI.
- Dark mode in email is three incompatible systems:
prefers-color-schemein WebKit clients, the[data-ogsc]attribute hack for Outlook.com, and forced colour inversion in the Gmail apps that you cannot opt out of. - Build with MJML or Maizzle and automate inlining. Hand-inlined CSS in a 400-line table layout is where email bugs come from.
Why html email template coding still looks like 2009
Email clients have no incentive to ship CSS features. A browser competes on rendering the open web; a mail client competes on search, calendar integration and spam filtering. Rendering someone else’s untrusted HTML is a liability surface, not a feature. So mail clients sanitise aggressively, cache aggressively, and change slowly.
Microsoft’s new Outlook for Windows does improve things. It renders with the same engine as Outlook.com, which means flexbox works, border-radius works, media queries work. But Microsoft publicly committed to supporting classic Outlook until at least 2029, enterprise fleets upgrade on five year cycles, and on the B2B lists we handle Outlook desktop regularly accounts for a third of opens. A newer client existing does not let you drop the Word engine. It gives you a fourth engine to test.
The honest framing: email is the last place in front-end work where progressive enhancement is not a philosophy, it is the only option that ships.

The four engines you are actually targeting
Forget the list of 40 clients in the testing tool. There are four behaviours:
- Word (classic Outlook for Windows): no flexbox, no grid, no
max-widthon block elements, nobackground-size, noborder-radius, nobox-shadow, no CSS custom properties, no media queries on desktop. Unreliablepaddingandmarginon<p>and<div>. Honours VML. - WebKit (Apple Mail on macOS, iOS Mail): nearly everything works, including
prefers-color-scheme, custom properties, SVG in some versions, and the checkbox hack. This is your showcase client and the one that misleads you into thinking email is fine. - Blink behind a sanitiser (Gmail web, Gmail apps with Google accounts, Outlook.com, new Outlook): good CSS support, but
<style>is parsed then rewritten. Outlook.com prefixes your class names. Gmail strips anything it does not recognise and drops the whole<style>block if the document is malformed. - The strippers: Gmail app on Android or iOS configured with a non-Gmail IMAP account (often abbreviated GANGA) removes
<style>completely. Only inline styles survive. No media queries at all.
That last group is why discussions of email client CSS support that end at “Gmail supports media queries now” are useless. Gmail the webmail does. Gmail the app carrying your client’s Office 365 account does not.
Responsive email tables without relying on media queries
The pattern that survives all four engines is the fluid hybrid, sometimes called spongy. The layout is fluid by default, capped with max-width on a <div>, and Outlook gets a fixed-width ghost table inside a conditional comment. Media queries become an enhancement, not the mechanism.
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html lang="en" xmlns="http://www.w3.org/1999/xhtml"
xmlns:v="urn:schemas-microsoft-com:vml"
xmlns:o="urn:schemas-microsoft-com:office:office">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width,initial-scale=1">
<!-- stops iOS Mail auto-resizing your layout -->
<meta name="x-apple-disable-message-reformatting">
<meta name="color-scheme" content="light dark">
<meta name="supported-color-schemes" content="light dark">
<title>Your order is on its way</title>
<!--[if mso]>
<xml><o:OfficeDocumentSettings>
<!-- the 120 DPI fix: without this Outlook scales every px by 1.25 -->
<o:PixelsPerInch>96</o:PixelsPerInch>
</o:OfficeDocumentSettings></xml>
<style>
table,td,div,p,a{font-family:Arial,Helvetica,sans-serif !important;}
</style>
<![endif]-->
</head>
<body style="margin:0;padding:0;width:100%;background:#eef1f5;">
<table role="presentation" width="100%" cellpadding="0" cellspacing="0" border="0"
style="background:#eef1f5;">
<tr>
<td align="center" style="padding:24px 12px;">
<div style="max-width:600px;margin:0 auto;">
<!--[if mso]>
<table role="presentation" width="600" cellpadding="0" cellspacing="0" border="0" align="center"><tr><td>
<![endif]-->
<table role="presentation" width="100%" cellpadding="0" cellspacing="0" border="0"
style="background:#ffffff;border-radius:8px;">
<tr>
<td style="padding:28px 24px;font-family:Arial,Helvetica,sans-serif;
font-size:16px;line-height:24px;mso-line-height-rule:exactly;color:#1d232e;">
Hi Priya, your order shipped this morning.
</td>
</tr>
</table>
<!--[if mso]></td></tr></table><![endif]-->
</div>
</td>
</tr>
</table>
</body>
</html>
Note mso-line-height-rule:exactly. Without it Outlook rounds line height up and your 24px rhythm drifts by two or three pixels per line. Invisible on one paragraph, obvious across a 600px block.
Columns that stack without a media query
For two columns, use display:inline-block on fixed-max-width divs with ghost table cells for Outlook. Because the containers are width:100%;max-width:300px, they wrap naturally when the viewport narrows. The Gmail IMAP case stacks correctly with zero CSS in the head.
<!--[if mso]><table role="presentation" width="600" cellpadding="0" cellspacing="0" border="0"><tr><td width="300" valign="top"><![endif]-->
<div style="display:inline-block;width:100%;max-width:300px;vertical-align:top;">
<!-- column one -->
</div>
<!--[if mso]></td><td width="300" valign="top"><![endif]-->
<div style="display:inline-block;width:100%;max-width:300px;vertical-align:top;">
<!-- column two -->
</div>
<!--[if mso]></td></tr></table><![endif]-->
One gotcha: inline-block elements are whitespace sensitive. If your templating engine pretty-prints, you get a 4px gap. Either strip whitespace between the divs in the build step or set font-size:0 on the parent cell and restore it on children. The same class of problem bites in browser layouts too, and the thinking behind responsive data table patterns that survive real content transfers directly: let content wrap, do not enumerate breakpoints.
Buttons, images and the small details that break in production
A padded anchor is the right button for every client except classic Outlook, which ignores the padding and collapses the click target to the text bounds. The fix is VML. After years of trying alternatives, we still use it:
<!--[if mso]>
<v:roundrect xmlns:v="urn:schemas-microsoft-com:vml"
xmlns:w="urn:schemas-microsoft-com:office:word"
href="https://example.com/orders/8821"
style="height:46px;v-text-anchor:middle;width:220px;"
arcsize="13%" strokecolor="#1a6ae0" fillcolor="#1a6ae0">
<w:anchorlock/>
<center style="color:#ffffff;font-family:Arial,sans-serif;font-size:16px;font-weight:bold;">
Track your order
</center>
</v:roundrect>
<![endif]-->
<!--[if !mso]><!-->
<a href="https://example.com/orders/8821"
style="display:inline-block;padding:13px 28px;background:#1a6ae0;color:#ffffff;
font-family:Arial,Helvetica,sans-serif;font-size:16px;font-weight:bold;
line-height:20px;text-decoration:none;border-radius:6px;">Track your order</a>
<!--<![endif]-->
arcsize is a percentage of the shorter side, so 13% of 46px lands near the 6px radius used in the HTML version. Keep the two labels and URLs in sync with a template variable. I have personally shipped a VML button pointing at a staging domain.
For images, always set display:block, border:0, an explicit width attribute, and height:auto in the style. Without display:block you get mysterious 1px to 4px gaps under images in Outlook and older Yahoo. Write alt text that reads as a sentence and style it, because roughly a quarter of your recipients will see it before they see the image. And do not slice a whole design into one JPEG. Image-only emails trip spam heuristics, break in dark mode, and give screen reader users nothing.
Dark mode in email is still three systems pretending to be one
On the web, dark mode is a solved problem if you use tokens properly, which we covered in dark mode done properly. Email has no such luxury. CSS custom properties do not exist in classic Outlook, and the Gmail apps will invert your colours whether you ask or not.
What actually works:
/ Apple Mail, iOS Mail, some Outlook builds /
@media (prefers-color-scheme: dark) {
.surface { background:#15181d !important; }
.ink { color:#e7e9ee !important; }
.ink-mut { color:#a7aebb !important; }
.logo-light { display:none !important; }
.logo-dark { display:block !important; width:auto !important; max-height:32px !important; }
}
/ Outlook.com and the Outlook mobile apps rewrite the DOM instead /
[data-ogsc] .surface { background:#15181d !important; }
[data-ogsc] .ink { color:#e7e9ee !important; }
Gmail’s apps ignore both and apply their own inversion to light backgrounds. You cannot override it. The practical defence is to design so that inversion does not destroy anything: avoid pure #ffffff panels sitting on near-white page backgrounds, never use dark text baked into a transparent PNG (it inverts to dark-on-dark), and give logos a solid background plate or a light stroke. Test one real send to a Gmail Android device before you promise a client dark mode support. The emulators lie about this specific behaviour.
The build pipeline, and the 102KB cliff
Hand-writing nested tables with inline styles is how you end up with a template nobody will touch. Two tools earn their place:
- MJML if you want a component abstraction and sane defaults, and you accept its generated markup. Fastest route to a working template for a team that does not want to learn Outlook’s quirks.
- Maizzle if you want to write Tailwind utilities and have a build step inline them, minify, and strip unused CSS. More control, more rope. If your team already thinks in utilities (the team-fit argument in Bootstrap vs Tailwind applies here almost unchanged), this is the better pick.
Whichever you choose, the inlining step is non-negotiable and must be automated. Juice, Premailer or the inliner built into your tool, it does not matter much, as long as a human is never maintaining both a class and its inline twin.
Then watch the byte count. Gmail clips the message body past 102KB and shows “View entire message”, severing everything after the cut including your unsubscribe link and your tracking pixel. Add a check to CI:
# fail the build if the rendered email exceeds Gmail's clipping threshold
SIZE=$(wc -c < dist/order-shipped.html)
if [ "$SIZE" -gt 102400 ]; then
echo "Email is ${SIZE} bytes, Gmail clips at 102400. Trim it." >&2
exit 1
fi
Most templates blow past 102KB for the same reason: repeated inline styles on every table cell in a long product loop. Shorten colour values, drop redundant declarations, and cap loops at 10 to 20 items with a “view all” link.
What we check before every send
- caniemail.com for any property you have not shipped before. It is the only support reference worth trusting, and it is maintained.
- Real-device test in: Outlook 2019 or classic Outlook on Windows at 120 DPI, Gmail web, Gmail Android with a non-Gmail account, Apple Mail iOS in dark mode. Litmus and Email on Acid cover the breadth; those four cover the failures.
role="presentation"on every layout table, alangattribute, a real<title>, and body text at 16px minimum. Screen readers announce layout tables as data tables otherwise.- Plain text version written by a human, not auto-generated from the HTML. Auto-generated versions leak alt text and tracking URLs.
- Every link tested after merge tags render. Personalisation tokens inside
hrefattributes are the single most common broken thing we find in client templates. - Open rates treated as directional only. Apple’s Mail Privacy Protection has been prefetching images since iOS 15, so a “68% open rate” on an Apple-heavy list is partly machine traffic. Measure clicks.
Frequently Asked Questions
Can I finally stop using tables for email layout in 2026?
No, not if classic Outlook for Windows is in your audience, and on B2B lists it usually is. Microsoft has committed to supporting classic Outlook until at least 2029, and its Word-based engine has no flexbox, no grid and no max-width on block elements. The compromise that works is fluid divs with conditional ghost tables for Outlook only.
Do I still need to inline all my CSS?
Yes, for anything structural, because the Gmail app strips the <style> block entirely when the account is a non-Gmail IMAP account. Keep <style> for enhancements only: media queries, dark mode, hover states. Automate the inlining in your build rather than maintaining it by hand.
What width should an email be?
600px is still the right default. Outlook’s reading pane at common window sizes gives you roughly 600px to 640px before horizontal cropping, and the number is so entrenched that stock assets, templates and client expectations all assume it. Going to 680px is survivable; going to 800px is not.
Are web fonts usable in email?
Partially. Apple Mail, iOS Mail and Outlook.com will load a font declared with @font-face or an @import, but classic Outlook ignores it and falls back to Times New Roman instead of your stack. The fix is an MSO-only <style> block that forces a system font family with !important, which is exactly what the head snippet above does.
Is interactive email (accordions, carousels, AMP) worth building?
Almost never. The checkbox and label hack works in Apple Mail and little else, AMP for Email never reached meaningful client support beyond a handful of senders, and both double your testing surface for a feature most recipients will not see. Put the interaction on a landing page and send a button.
If you take one decision from this: pick your baseline client explicitly, write it down, and build to it. On a consumer list that is Gmail web and Apple Mail, and you can be fairly expressive. On a B2B list it is classic Outlook, and every layout choice flows from the Word engine’s limits. Teams that skip this step build pretty templates in Apple Mail, then spend two days patching Outlook the morning before the send. We have done that. Once is enough.


