How to Use the CSS Inliner
Paste the HTML, add extra CSS if you have it, and inline: the result shows the new HTML, a preview and every rule the inliner could not apply.
- Paste the HTML of your email, with its <style> blocks, or open an .html file.
- Optionally paste extra CSS. It is applied after the <style> blocks, so it wins when two rules have the same specificity.
- Choose Inline CSS, then read the warnings: they list rules that were kept in a <style> block or removed.
- Copy the inlined HTML or download it as an .html file, and check the preview.
- Send a test message to the email apps your readers use before you send the campaign.
How the CSS Inliner Works
The CSS inliner applies the CSS cascade to each element of your email, then writes the winning declarations as inline styles and reports what had to stay in a <style> block.
How the Inliner Resolves Conflicting CSS
When several rules set the same property on an element, the inliner keeps the value the browser cascade would choose. A declaration with !important beats one without it; among equals, the more specific selector wins, so an ID beats a class and a class beats an element name; and when specificity is equal, the rule that comes later wins. Inline styles already in the HTML count as the most specific normal declarations.
Why Media Queries Stay in a Style Block
A style attribute cannot say “only on screens narrower than 600 pixels”, so @media rules, :hover and other state rules, ::before and ::after, @font-face and @keyframes are kept in a <style> block in the head. Because inline styles beat a <style> block, a responsive override only takes effect when its declarations carry !important; the result warns about media query declarations without it.
What the CSS Inliner Never Does
It does not download linked stylesheets, @import files, fonts or images, and it does not run scripts. It is also not an HTML sanitizer: scripts, event handlers and forms in your HTML are copied to the output unchanged and flagged as warnings, while the preview blocks them. Conditional comments for Outlook are copied as written, and the markup inside them is not inlined.
CSS Inlining Order of Precedence
These are the rules the inliner follows, from the strongest to the weakest, when two declarations set the same property on an element.
| Order | Declaration | Example |
|---|---|---|
| 1 | Inline style with !important | style="color: red !important" |
| 2 | Stylesheet rule with !important | .alert { color: red !important; } |
| 3 | Inline style already in the HTML | style="color: red" |
| 4 | More specific selector | #intro beats .lead, which beats p |
| 5 | Later rule with equal specificity | The CSS field beats the <style> blocks |
Within the same level, a later rule wins over an earlier one. A selector list such as a, a:hover is split into separate selectors before matching.
What Stays in a Style Block
Some CSS has no element or condition a style attribute can express, so the inliner keeps it in a <style> block or removes it, and the result lists each case.
- Kept: @media queries, :hover, :focus and other state rules, ::before and ::after rules, @font-face, @keyframes, @container and @layer.
- Removed: @import and at-rules such as @supports, @page and @charset, unless you keep the original <style> blocks.
- Removed: state and ::before or ::after rules from the extra CSS field, and state selectors that share a rule with plain selectors.
- Unchanged: <style> blocks marked data-embed and everything inside conditional comments.
Frequently Asked Questions
What Does a CSS Inliner Do?
It reads the CSS in your email's <style> blocks and writes each matching declaration into the style attribute of the elements it applies to, for example <p class="lead"> becomes <p class="lead" style="color: #1d4ed8;">. Email apps that remove or ignore <style> blocks still see those inline styles.
Do I Still Need to Inline CSS for Email?
Many modern email apps support CSS in a <style> block, but support differs between apps, versions and account types, and some strip embedded styles in certain views. Inlining the core layout and typography is still the safest default; keep responsive rules in the <style> block for the apps that support them.
Which CSS Wins When I Paste Extra CSS?
The CSS field is applied after the <style> blocks in your HTML. When a rule in the CSS field and a rule in the HTML have the same specificity, the CSS field wins; a more specific selector or an !important declaration still wins regardless of where it is.
Does the Inliner Keep Important Declarations?
By default the inlined styles are written without !important, because an inline !important would block the responsive overrides in your media queries. The cascade still respects !important when it chooses values. Turn on Keep !important in inline styles under More options to keep the flag.
Is Inlined CSS Guaranteed to Look the Same Everywhere?
No. Inline styles remove one source of differences, but each email app still supports a different set of CSS properties and applies its own rules. Check the inlined HTML with a preview and send test messages to the apps your readers use.