Email HTML Compatibility: Tables, Inline CSS and Client-Safe Markup
Explain the constrained email rendering model, testing matrix, fallbacks, accessibility and tracking/privacy.
The constrained rendering model: what email clients strip
Email clients are not web browsers. They deliberately remove, rewrite, or ignore large portions of the HTML specification to prevent scripting, limit layout complexity, and reduce the security surface area. The rendering model resembles HTML 3.2 more than HTML 5.
These elements are removed or disabled before display:
<script>,<iframe>,<form>,<input>, and<video>. Any dynamic behavior is lost.<style>blocks in the<head>. Gmail strips them entirely. Outlook.com ignores them. Only Apple Mail and some desktop clients (Thunderbird, Outlook desktop) respect them reliably.<link>to external stylesheets. No major client loads them. CSS must reside in the email body.<div>-based layouts usingfloat,flex, orgrid. Outlook for Windows uses Word's layout engine, which does not support these properties.
These survive across all major clients:
<table>-based layout with inline CSS. Nested tables render predictably everywhere.- Inline
styleattributes on individual elements. This is the only CSS delivery method with universal support. font-family,font-size,color,background-color,width,height,padding,border,text-align, andvertical-alignon table cells.display: blockon<img>to remove bottom whitespace gaps.mso-prefixed properties for Outlook-specific overrides.
Diagnostic check: Open your HTML in a local browser. It will look correct. Then send it to a test address and open it in Gmail, Outlook.com, Apple Mail, and a mobile client. Differences between the browser and each client are the direct result of that client's rendering model. You cannot fix these by adding more CSS. You must build for the lowest common denominator.
Why tables are the only reliable layout engine
Because <div> layouts fail in Outlook for Windows, the only structure that survives everywhere is a <table> with role="presentation" to prevent screen readers from announcing table semantics. This is not a design preference. It is a hard limit imposed by the Word rendering engine.
Structure rules:
- Use a single outer
<table>withwidth="100%"andcellpadding="0" cellspacing="0". - Nest inner tables for columns. Each column is a
<td>withwidthset as a fixed pixel value or percentage. - Set
align="left"oralign="center"on table cells for older clients that ignore CSStext-align. - Never use
<colgroup>or<col>. Outlook desktop ignores them.
Example skeleton with inline CSS only:
<table role="presentation" cellpadding="0" cellspacing="0" border="0" width="100%">
<tr>
<td align="center" style="padding: 20px 0;">
<table role="presentation" cellpadding="0" cellspacing="0" border="0" width="600">
<tr>
<td style="font-family: Arial, sans-serif; font-size: 16px; color: #333333;">
Your content here.
</td>
</tr>
</table>
</td>
</tr>
</table>
Observable failure: Replace the inner table with a <div style="display: grid; grid-template-columns: 1fr 1fr;">. In Outlook for Windows, every element stacks vertically and column widths are ignored. The email remains readable, but the intended layout is gone. No CSS fix in the <head> recovers it because Outlook never reads that block.
The minimum testing matrix
The HTML specification does not define email compliance. You must test against real clients. At minimum, verify rendering in these four:
- Gmail (web and mobile app). Strips
<style>blocks, rewritesfont-sizeto a minimum of 13px, ignoresline-heightbelow a threshold. - Outlook.com (web). Removes
<style>blocks, ignorespaddingon<a>tags, does not supportborder-radius. - Outlook for Windows (desktop). Uses Word's rendering engine, ignores flex/grid, strips
<style>blocks, does not supportmax-width. - Apple Mail (macOS and iOS). Respects
<style>blocks and most inline CSS, but some versions do not support background images on table cells.
Testing without a paid service:
- Create free accounts on Gmail and Outlook.com.
- Use a disposable email service for Apple Mail if you do not own a Mac.
- Send test emails from a plain-text SMTP tool or local script to avoid platform-specific preprocessing.
- Open each client in a private browser window to prevent cached CSS from earlier renders.
What conversion tools cannot fix: No HTML-to-email converter can make a <div> layout work in Outlook for Windows. The converter does not change the rendering engine. It only outputs markup. If your source HTML uses modern layout, the converter must rewrite it into nested <table> elements with inline CSS. Tools claiming one-click conversion usually fail this step. Verify by inspecting the output: if you see <style> in the <head> or <div> with display: flex, the output will break in major clients.
Fallbacks for fonts, images, and spacing
Email clients apply their own defaults when your CSS is ignored. Provide fallback values for every property that matters visually.
Fonts:
- List web fonts last.
font-family: 'Open Sans', Arial, sans-serif;works in Apple Mail but fails in Gmail, which ignores the web font entirely. - Always end with a generic fallback:
seriforsans-serif. - Set
font-sizein pixels, notemorrem. Gmail convertsemto an unpredictable value.
Images:
- Always include
widthandheightattributes on<img>tags. Some clients ignore CSSwidthon images. - Set
display: blockinline to remove the 4px bottom gap that many clients add to inline images. - Use
alttext for accessibility and for clients that block images by default.
Spacing:
- Use
<td>padding andcellpaddingon the outer table. Do not rely onmargin. Gmail strips it from<p>tags. - For vertical spacing between rows, add an empty
<tr>with a<td>of fixed height andline-height: 0; font-size: 0;to prevent the client from adding extra space.
Observable failure: Set line-height: 1.2 without a unit. Gmail may interpret it as 1.2px and collapse your text to a single line. Always use line-height: 1.2em or a pixel value.
Accessibility and dark mode constraints
Email clients increasingly apply automatic dark mode, high-contrast, and user-defined font scaling. These are client-side transformations, not CSS overrides you control.
What you can do:
- Use
prefers-color-schememedia queries inside a<style>block (only some clients read it) to swap background colors. Write a separate rule for[data-ogsc](Outlook specific) and[data-ogsb](Gmail's dark mode attribute). - Set explicit
background-coloron every<td>and<table>that needs a colored background. Without it, dark mode may invert the entire email. - Use
color: #333333rather thancolor: black. Pure black text on a dark background is invisible in dark mode.
Accessibility requirements:
- Use
role="presentation"on layout tables so screen readers do not announce table structure. - Provide
alttext on every image. The HTML specification requiresaltfor validity, and email clients use it for image-blocked previews. - Do not use images for text. Clients that block images (Gmail by default) will show empty boxes.
What cannot be recovered: If your email uses only images to convey information, a conversion tool cannot extract that text and insert it as live HTML. The converter sees an image file, not the text inside it. You must provide the fallback alt text yourself.
Tracking pixels and privacy limitations
Email clients now block remote images by default, strip tracking parameters, and rewrite URLs to remove click-through data. The HTML specification defines how URLs are resolved, but email clients add their own rules:
- Gmail rewrites
hreflinks through its own proxy. The original URL is preserved in the redirect, but?utm_source=emailparameters may be stripped. - Image-based tracking (a 1x1 transparent pixel) is blocked until the user enables image loading. You will see zero opens for recipients who block images.
- Some corporate clients (Outlook Exchange, Gmail for Workspace) strip external image references entirely, even after user consent.
What you can do:
- Use text-based tracking with a unique link per recipient instead of image pixels. The link itself can include the tracking ID.
- Accept that open rates are unreliable. No conversion tool can force a client to load a remote image.
- Do not place tracking code inside
<style>blocks. Clients that strip<style>also remove CSS-based tracking such asbackground-imageon<body>.
Hard limits that conversion cannot recover
When you convert a web page into an email, these are permanently lost:
- Layout fidelity. A multi-column flex layout becomes a single-column table or stacked rows. No tool preserves the original grid.
- Interactivity. Forms, animations, hover effects, and JavaScript are stripped.
- Web fonts. They appear only in clients that support them (Apple Mail, Thunderbird). Gmail and Outlook fall back to system fonts.
- Responsive behavior. Media queries work in Apple Mail but fail in Gmail and Outlook. Your email will be one width for all devices.
- Exact spacing. Clients enforce minimum font sizes and line heights. A 10px gap in your source may become 14px in Gmail.
The only way to verify what survived is to test in each client. No validation tool, preview, or specification check can predict how a particular client will rewrite your markup. The HTML specification tells you how the web works. Email clients tell you how the inbox works. They are not the same document.