Email clients don't render CSS the same way browsers do. Mobile inboxes strip styles, dark mode inverts colors, and some clients reject external stylesheets entirely. The result: templates that look polished in Litmus or Email on Acid fall apart in Gmail, Outlook, or Apple Mail on an iPhone.
This post covers the technical rules and testing workflow to design templates that stay readable across devices and color schemes. You'll learn which CSS properties work, how to handle color fallbacks, and where to catch rendering problems before they hit inboxes.
Why Email CSS Is Different From Web CSS
Email clients use older rendering engines and apply stricter security rules than browsers. Gmail strips external stylesheets and <style> tags entirely. Outlook uses Microsoft Word's rendering engine, which doesn't support modern CSS layout. Apple Mail respects more CSS than Gmail but still rejects flexbox and CSS Grid.
The practical result: inline styles are your primary tool. Fallbacks matter because some clients ignore newer properties. Testing is mandatory because you can't assume a template will render the same way twice.
Core CSS Rules for Email Templates
Inline Styles Are Required
External stylesheets and <style> blocks work in some clients (Apple Mail, Outlook 365) but not others (Gmail, Yahoo). Inline styles using the style attribute apply everywhere. Use a CSS inliner tool to automatically convert stylesheet rules into inline attributes before sending.
Example: Instead of a <style> block, write <a href="#" style="color: #0066cc; text-decoration: none;">. The inliner converts your source template and outputs production code.
Supported CSS Properties
Safe properties that work across email clients: color, background-color, font-family, font-size, font-weight, line-height, text-align, padding, margin, border, width, height, display (block, inline, inline-block, none only). Use tables for layout instead of divs with floats or flexbox.
Avoid: position (absolute, relative, fixed), transform, animation, flex, grid, media queries in all clients (some support them; don't rely on them), box-shadow, text-shadow, gradients (limited support).
Table-Based Layout Still Wins
Modern email design frameworks (MJML, Foundation for Emails) generate table-based HTML because tables render predictably across clients. A single-column table with width="100%" and nested cells for content blocks ensures layout stays intact on mobile.
Example structure: Outer table wraps the entire email. Inner tables define sections (header, hero, content, footer). Cells use width attributes and padding to control spacing. Mobile styles use max-width on the outer table and display: block on stacked cells.
Mobile Rendering: Responsive Design in Email
Media Queries Work in Some Clients
Apple Mail, Outlook 365, and Gmail (partial) support media queries. Outlook desktop and older Gmail versions ignore them. Write media queries for clients that support them, but design your default (mobile-first) layout to work without them.
Pattern: Set cell widths to 100% by default. In a media query targeting screens wider than 600px, set widths to 50% or use display: inline-block to create columns. Clients that ignore the query still see the 100% mobile layout.
Width Attributes vs CSS
Use width HTML attributes on tables and cells alongside CSS width styles. Older clients read the attribute; newer ones read CSS and override. Example: <table width="600" style="width: 600px; max-width: 100%;">. The max-width: 100% forces mobile clients to shrink the table to fit the viewport.
Font Size and Line Height
Set font-size in pixels (not em or rem; email clients don't scale relative units consistently). Use line-height to control spacing between lines. Example: font-size: 16px; line-height: 1.5; creates readable body text. For mobile, 16px minimum prevents iOS from zooming in on form inputs.
Dark Mode: Color Strategy and Fallbacks
The Dark Mode Problem
Apple Mail, Gmail (iOS), Outlook (iOS), and Thunderbird now support dark mode. When enabled, the client inverts colors: white backgrounds become dark, dark text becomes light. If your email relies on a white background with dark text, it becomes a dark background with light text. That's fine. But a dark background with light text inverts to a light background with dark text, making it unreadable.
Dark mode also strips background images and some color properties, depending on the client.
Use Color-Scheme Meta Tag
Add <meta name="color-scheme" content="light dark"> to the email head. This tells Apple Mail and Gmail that your template supports both light and dark modes. Without it, the client may apply aggressive color inversion that breaks your design.
Stick to Light Backgrounds and Dark Text
The safest approach: white or very light background with dark gray or black text. This renders correctly in light mode and inverts gracefully in dark mode. Avoid dark backgrounds, colored text on colored backgrounds, and relying on background images for content.
Use Transparent or Adaptive Colors
Some email clients (Apple Mail, Outlook 365) support CSS color properties that respect dark mode. Use color: #1a1a1a; for text and background-color: #ffffff; for containers. Avoid pure black (#000000) and pure white (#ffffff) in text because they can create contrast issues in some dark mode implementations.
For accent colors (buttons, links), use colors that work in both light and dark. Blues (#0066cc), greens (#008000), and purples (#663399) remain readable. Test orange and red in dark mode; they can become hard to read.
Fallback Colors for Unsupported Clients
Some clients don't support dark mode at all. Use inline styles with fallback values. Example: style="background-color: #ffffff; color: #1a1a1a;". Clients that don't support dark mode show white background with dark text. Clients that do support it invert appropriately.
For buttons, use a solid background color instead of a background image. Example: <a href="#" style="background-color: #0066cc; color: #ffffff; padding: 12px 24px; text-decoration: none; display: inline-block;">Click here</a>. The button renders as a blue block with white text in light mode. In dark mode, the client may invert it to a light background with dark text, but the link remains clickable.
Common Rendering Failures and Fixes
Broken Images on Mobile
Images without height and width attributes cause layout shift on mobile. Always add width and height attributes (or inline styles) to every image. Use max-width: 100%; to shrink images on small screens without distorting them. Example: <img src="image.jpg" width="600" height="300" style="width: 100%; height: auto; max-width: 600px; display: block;" alt="Description">.
Padding and Margin Collapse
Some email clients (Outlook) don't respect margin on elements inside tables. Use padding on the cell instead. Example: Instead of <div style="margin: 20px;">, use <td style="padding: 20px;">.
Links and Button Rendering
Use <a> tags for links, not <button> elements. Buttons don't render consistently in email. Style links with inline CSS to create button-like appearance. Use display: inline-block to add padding and make the link area larger.
Font Stack Fallbacks
Specify a font stack with fallbacks. Example: font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;. If the client doesn't support Segoe UI, it falls back to Tahoma, then Geneva, then a generic sans-serif. Always end with a generic family (serif, sans-serif, monospace).
Testing Workflow
Test Across Clients Before Sending
Use a testing service (Litmus, Email on Acid) to preview your template in 50+ email clients and devices. These services render your template in actual clients, not simulations. Check renderings on Gmail (web, iOS, Android), Outlook (desktop, web, iOS), Apple Mail (Mac, iOS), Yahoo, and AOL.
Focus on: layout (columns, spacing), colors (text, backgrounds, buttons), images (sizing, display), and links (clickability, styling). Dark mode previews are available in most testing tools.
Manual Testing on Real Devices
Send test emails to personal accounts on your phone, tablet, and desktop. Open in different email apps (Gmail, Apple Mail, Outlook, Samsung Mail). Check that text is readable, buttons are clickable, and images load. Dark mode: enable it on your phone and resend the test email.
Checklist Before Launch
Verify: All images have width and height attributes. Inline styles applied to all elements. Table-based layout with width attributes. No external stylesheets or <style> blocks. Font sizes 16px minimum for body text. Color contrast meets WCAG AA standard (4.5:1 for text). Links are styled as <a> tags with underline or button treatment. Dark mode meta tag present. Media queries included for clients that support them. Tested in Litmus or Email on Acid across 10+ clients. Tested on real devices in light and dark mode.
Automation and Reusable Patterns
Use a Template Framework
MJML (Mailjet Markup Language) and Foundation for Emails generate email-safe HTML from a simpler syntax. You write components (sections, columns, text, images) and the framework outputs production HTML with proper table structure, inline styles, and mobile media queries.
Example MJML: <mj-section><mj-column><mj-text>Hello</mj-text></mj-column></mj-section> compiles to a table-based layout with inline styles. The framework handles inlining, fallbacks, and mobile rendering.
CSS Inliner Tools
If you write HTML and CSS separately, use an inliner (Premailer, MJML CLI, Mailmodo) to convert stylesheets into inline attributes before sending. This ensures your source template stays readable and maintainable while the production version works across clients.
Component Library
Build reusable components (header, hero, two-column section, footer, button, card) and test them once. Combine components into new templates without retesting each piece. Document the components with do's and don'ts (e.g., "Don't use background images in hero on mobile").
Reality Check: When Dark Mode Breaks Templates
Some design choices fail in dark mode no matter what: dark backgrounds with light text invert to light backgrounds with dark text and become unreadable. Colored text on colored backgrounds lose contrast. Background images disappear entirely. Relying on borders or shadows to define structure fails when dark mode strips them.
If your brand requires a dark background or colored text, test extensively in dark mode. Use additional borders, text labels, or structural elements to maintain readability when colors invert. Consider a light-background variant for dark mode users.
Email dark mode is not optional on modern clients. Templates that ignore it frustrate users and may get marked as spam or deleted unread.
What to Do Next
Start by auditing your current templates in a testing service. Check renderings on mobile and in dark mode. Identify broken layouts, unreadable colors, or missing images. Then pick one template and apply the fixes: add width/height attributes to images, convert to inline styles, test in Litmus, and deploy. Use that template as a reference for future designs.
If you're building templates from scratch, use a framework like MJML or Foundation for Emails. If you're editing existing templates, invest in a CSS inliner and email testing service to catch rendering issues before they reach inboxes.
FAQs
Do I need to use tables for email layout?
Yes. Tables render consistently across email clients. Divs with CSS layout properties (flexbox, grid, float) fail in Outlook and older Gmail versions. Use tables for structure and CSS for styling within cells.
Can I use external stylesheets in email?
Gmail strips external stylesheets and <style> blocks. Outlook 365 and Apple Mail respect them, but you can't rely on all clients reading them. Use an inliner to convert stylesheets into inline styles before sending.
How do I make email templates responsive on mobile?
Use width="100%" and max-width: 100%; on tables. Add media queries for clients that support them (Apple Mail, Outlook 365, Gmail partial). Design the default layout to work on mobile; media queries add desktop optimizations for clients that read them.
Why do my colors look different in dark mode?
Dark mode clients invert colors. White becomes dark, dark becomes light. Dark backgrounds with light text invert to light backgrounds with dark text, becoming unreadable. Use light backgrounds and dark text, which invert gracefully. Test all accent colors (buttons, links) in dark mode.
People Also Ask
What email clients support dark mode?
Apple Mail (Mac and iOS), Gmail (iOS), Outlook (iOS), and Thunderbird. Gmail on Android and Outlook desktop do not yet support dark mode. Design for light mode as default; dark mode support is a bonus for modern clients.
Should I use !important in email CSS?
Avoid it. !important can override client resets and cause unexpected styling. Use inline styles with proper specificity instead. If a property is being overridden, check your CSS inliner settings or the client's documentation.
Can I use web fonts in email?
Limited support. Some clients (Apple Mail, Outlook 365) support @font-face, but many don't. Always include a fallback font stack with system fonts (Arial, Tahoma, Georgia). Users may see a different font than intended, so design for readability with fallbacks.
How do I test dark mode if my email client doesn't support it?
Use Litmus or Email on Acid. Both services show dark mode previews in clients that support it. You can also enable dark mode on iOS (Settings > Display & Brightness > Dark) and test in Apple Mail or Gmail app.
What's the minimum width for email templates?
Most email clients display 600px width on desktop. Use width="600" on your outer table. Mobile clients shrink it to fit the screen. Avoid templates wider than 600px; they break on older devices and small screens.
Can I use CSS Grid or Flexbox in email?
No. Outlook desktop and many other clients don't support them. Use tables for layout. CSS Grid and Flexbox work in Apple Mail and newer Gmail versions, but you can't rely on all recipients seeing the layout correctly. Stick to tables.
How do I handle background images on mobile?
Use a solid background color as fallback. Example: style="background-image: url('image.jpg'); background-color: #f0f0f0;". On mobile and in dark mode, the image may not load, but the solid color ensures readability. Don't rely on background images for critical content.
Why are my buttons not clickable in some email clients?
Use <a> tags, not <button> elements. Add display: inline-block and padding to create a button-like appearance. Some clients (Outlook) require specific styling for links to be recognized as clickable. Test in Litmus to verify.
If this post is wrong, outdated, or you would take a different path
I write from work I have done on real sites. Search products change, and a step that was right when I published can go stale. I can also be wrong about the method.
If you disagree with the approach, the facts, or the outcome, I want the detail. Tell me what is off, what you would do instead, and where you saw it. I use that to correct the post so the next reader is not stuck.
This is not a comment thread. Use Contact me so the note is tied to this post and I can reply.
You are sending feedback for
Design Email Templates That Render Perfectly on Mobile and Dark Mode
Email Marketing & Nurture
https://hammadshk.com/blog/design-email-templates-that-render-perfectly-on-mobile-and-dark-mode