Why email CSS needs inlining
Web pages keep their styles in the head. Many inboxes don’t: some strip <style> blocks, some drop them when an email is forwarded, and some ignore classes. Styles written on each element (style="…") survive almost everywhere, so most email platforms inline CSS when you send. If you build HTML yourself, or paste it into a platform that doesn’t inline, do it before you send.
What stays in the head
- Media queries (
@media), for mobile layouts and dark mode. Inboxes that support them read them from the head, so keep!importanton those rules to beat the inline styles. - Hover and other states (
:hover,:focus), and generated content (::before). - Web fonts (
@font-face,@import). - Any
<style data-embed>block, left exactly as it is (the same convention Mailchimp uses).
Tips
- Inlining makes the HTML bigger. Gmail clips emails over 102 KB, so check the size after inlining.
- Keep a copy of the un-inlined source for editing; inline as the last step.
- Inline styles don’t replace HTML attributes Outlook still needs, such as
widthon images and tables.
Frequently asked questions
Does my email’s HTML get uploaded?
No. The inliner runs in your browser; the HTML isn’t sent anywhere.
Which wins: a class or an inline style already on the element?
The inline style, as in a browser, unless the class rule is marked !important. The inliner follows the same cascade, so the result looks the same as before.
Will my mobile styles still work?
Yes. Media queries stay in the head. Mark their declarations !important so they override the inlined styles in inboxes that support them.
Should I keep the styles in the head as well?
Usually not, but “Keep all styles in the head too” helps when your media queries target classes and you want everything readable in the source.
Do I need this if my email platform inlines CSS?
Not for sends from that platform. It helps when you hand-code, paste HTML into a platform that doesn’t inline, or want to see exactly what inboxes will get.