New guide: how to warm up a dedicated IP without hurting your reputation. Read now →
Log in
MigoSMTP
Sending and campaignsUpdated 26 Oct 2026

CSS in HTML Email: What Works in Gmail, Outlook and Apple Mail and How to Build Safely

A practical guide to CSS in email: inline styles, supported properties, Outlook rendering quirks, media queries and responsive layouts, web fonts and fallbacks, tables for layout, and how to test across clients.

LF
Written by Lena Fischer
European Deliverability and Privacy Liaison
Reviewed by Mei Lin Tan
  • Published10 Oct 2025
  • Read time6 min
  • Length1,318 words
Share this guide

Writing HTML for email is not like writing HTML for the web. Browsers follow current standards and mostly agree with each other; mail clients do not. Some strip parts of your stylesheet, some use a rendering engine from another era, some rewrite your code for security or to add dark mode, and a small number ignore most of it. The result is a craft with its own rules: build with tables, inline critical styles, keep to a conservative set of properties and test in the clients your audience actually uses. This guide gives a working summary of what you can rely on, where the big clients differ, how to build responsive layouts that degrade gracefully, how to handle fonts and images, what to avoid and a practical testing workflow. Support changes with new versions of clients, so use this as a starting point and verify with a current compatibility reference and with real tests.

FoundationTable-based layout, inline styles for anything critical, a conservative property set
Biggest troubleDesktop Outlook for Windows, which uses the Word rendering engine
ResponsiveFluid widths plus media queries, with a mobile-friendly default that works without them
ProcessBuild, inline, send to real clients, fix, repeat

How clients differ

ClientRendering engine and behaviourPractical effect
Outlook for Windows (desktop, classic)Microsoft Word engineNo support for many modern properties; limited margin, padding, background and width behaviour; needs conditional markup for some effects
New Outlook and Outlook on the webBrowser-based enginesMuch better support, but not identical to the old client
Gmail (web and apps)Own sanitiser; supports a style block with limitsStrips unsupported rules; rejects the whole style block if it contains certain errors; clips large messages
Apple Mail and iOS MailWebKitExcellent support, including modern CSS and media queries
Samsung, Yahoo, AOL and othersVariedMostly good, with quirks; test them
Dark mode in several clientsColours are inverted or adjustedTest both modes; see accessible HTML email and dark mode

Market share differs by audience. Check the clients in your own reports, since a business-to-business audience may be heavy on Outlook and a consumer audience on Gmail and Apple Mail.

Structure: use tables

For a layout that holds in every client, build the skeleton from nested tables with explicit widths and set role="presentation" so that screen readers do not announce them as data. Use cellpadding, cellspacing and border attributes in addition to CSS. A common pattern is a centred wrapper of up to about 600 pixels wide with inner tables for rows and columns.

<table role="presentation" width="100%" cellspacing="0" cellpadding="0" border="0" bgcolor="#f4f4f4">
  <tr><td align="center">
    <table role="presentation" width="600" cellspacing="0" cellpadding="0" border="0" style="max-width:600px;width:100%;" bgcolor="#ffffff">
      <tr><td style="padding:24px;font-family:Arial,Helvetica,sans-serif;font-size:16px;line-height:24px;color:#222222;">
        Content goes here.
      </td></tr>
    </table>
  </td></tr>
</table>

Inline the important styles

Put critical styles directly on elements with the style attribute. Clients that drop or alter a style block still render the message acceptably. A <style> block in the head remains useful for media queries and for hover effects, which only some clients support. Build with a stylesheet and run an inliner as part of your build, then check the result; do not hand-inline hundreds of rules. Keep the HTML small, because Gmail clips messages over about 100 KB, which hides the footer and the unsubscribe link and breaks open tracking. See email length.

Properties: safe, risky and avoid

Property or featureSupportAdvice
font-family, font-size, color, line-height, text-alignBroadSafe; always give a font stack ending in a generic family
background-color and bgcolorBroadUse both, for Outlook
padding on tdBroadUse padding on table cells, not on divs
marginPatchy, particularly in OutlookAvoid; use spacer cells or padding
width and max-widthWidth is broad; max-width fails in old OutlookSet width and use conditional markup for a fixed Outlook width
border, border-radiusBorder broad; radius ignored in old OutlookTreat radius as an enhancement
background-imageBroad outside Outlook; needs VML in old OutlookAlways set a background colour fallback; see images blocked
float, position, flexbox, gridPoor or absent in several clientsAvoid for layout; use tables
CSS variables, calc()Not reliableAvoid
Media queriesSupported in Apple Mail, many mobile clients and Gmail apps (varies)Use for enhancement, not as the only way to be readable on a phone
Web fonts (@font-face)Apple Mail and some others; ignored elsewhereAlways provide a safe fallback stack
JavaScript, forms, iframesBlocked in nearly all clientsDo not use
SVG imagesInconsistentUse PNG or JPEG for important graphics

Responsive without breaking

There are two complementary approaches. Fluid layouts use percentage widths and a maximum width so that the content scales down to the screen. Media queries restyle the layout for small screens, for instance stacking columns and enlarging buttons. A robust strategy is to make the default layout work on a narrow screen without any media query, with a single main column and large tap targets, and to use media queries and conditional markup to enhance the desktop view where supported. Gmail on some account types does not support media queries, so a design that depends on them will break there. Keep body text at 14 to 16 pixels or larger, buttons at least 44 pixels tall and links separated enough to tap.

Outlook-specific techniques

  • Conditional comments target the Word engine: <!--[if mso]> ... <![endif]--> lets you give Outlook a fixed-width table or VML shapes while other clients ignore it.
  • mso- properties such as mso-line-height-rule: exactly fix line spacing issues.
  • Image sizing: set explicit width and height attributes; Outlook may ignore CSS sizes and may scale images using dots-per-inch metadata.
  • Buttons: use the table-cell button pattern, or VML for rounded buttons.
  • Test the classic desktop version specifically; web and new versions behave differently.

Fonts and colour

Rely on system fonts (Arial, Helvetica, Georgia, Verdana, Tahoma, Times New Roman, Trebuchet MS) in a stack, such as font-family: "Segoe UI", Arial, Helvetica, sans-serif. If you add a web font, the stack must still look acceptable if the font fails to load. Use sufficient colour contrast (a ratio of at least 4.5 to 1 for body text) and do not rely on colour alone to convey meaning. Specify both text and background colours explicitly so that dark mode adjustments do not produce unreadable combinations.

Common mistakes

Teams new to email development repeat a few errors. They design in a browser and assume the result holds everywhere. They use margins for spacing and find the layout collapsed in Outlook. They rely on a hero image for the message and see an empty box when images are off. They paste a large web page template with many unused rules and trigger Gmail clipping. They forget that the footer and the unsubscribe link must remain visible. And they test only on their own phone. Keep a short checklist beside the template, covering structure, inlining, fallbacks, size and testing, and review every new design against it before it is sent to a real list.

Testing workflow

  1. Build a base template and keep it under version control.
  2. Run an inliner and a validator as part of the build.
  3. Send to real accounts in Gmail (web and app), Outlook (classic, new, web and mobile), Apple Mail on desktop and iPhone, and one Android client. A rendering preview service helps with coverage, but real accounts settle disputes.
  4. Check with images off, in dark mode and at narrow widths.
  5. Test the plain-text version and the headers; see HTML email templates.
  6. Run the finished message through the spam checker.
  7. Keep a log of known quirks and fixes in your team documentation.

Email CSS is not glamorous, but its rules are stable enough to learn. Use tables, inline what matters, treat modern CSS as enhancement and test in the clients that count. The templates that follow these habits survive client updates with little change.

Send your templates through a reliable pipeline Multipart HTML and text with correct encoding, via the relay or the API.

See the email API

References and further reading

Frequently asked questions

Why does my email look different in Outlook?

Classic desktop Outlook uses the Word rendering engine, which ignores many modern CSS properties. Use tables, inline styles and conditional markup.

Should I use inline CSS in email?

Yes for critical styles. Keep a style block for media queries and enhancements, and inline with a tool as part of your build.

Do media queries work in Gmail?

Support varies by account type and app. Design a layout that is usable without them.

Can I use web fonts in email?

Only as an enhancement. Always provide a fallback font stack, since many clients ignore web fonts.

How should I test an HTML email?

Send to real accounts in Gmail, Outlook, Apple Mail and Android clients, with images off and in dark mode, and use a rendering preview for extra coverage.

Topics#css#html email#outlook#gmail#responsive
Was this guide helpful?Your answer helps us improve our documentation.

Start sending in minutes.

Create an account, add your domain and send your first email.

Get started Talk to sales