Menu

1 / 2

How to Inline CSS for HTML Email, The Complete Guide

DEV Community·Min8T·6 months ago
#QxMhuNpa
#css#hero#style#inline#email
Reading 0:00
15s threshold

Crosspost note. Originally published at min8t.com/articles/inline-css-for-email . I'm one of the maintainers of MiN8T, which makes the in-browser CSS inliner referenced at the end. The technical content here applies regardless of which inliner you reach for.

You write CSS in a <style> block, the way you have for two decades on the web. You hit send. Half your subscribers see your beautiful design. The other half see something else : a colorless wall of text, a stack of mis-aligned images, a call-to-action that has lost its rounded corners and bright background and is now indistinguishable from the body copy.

The reason: most email clients strip or partially strip <style> blocks. Gmail mobile, Yahoo, AOL, several enterprise clients. They discard your stylesheet entirely. The fix is older than the problem: inline every style as a style="..." attribute on the element it targets .…

Continue reading — create a free account

Join HashtagPLUS to read full articles, follow hashtags, vote, and join the conversation.