<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: Muhammad Iqbal</title>
    <description>The latest articles on DEV Community by Muhammad Iqbal (@iqbalaabi).</description>
    <link>https://dev.to/iqbalaabi</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F4180072%2F394f808f-66eb-41c1-b04e-38262945ddb7.png</url>
      <title>DEV Community: Muhammad Iqbal</title>
      <link>https://dev.to/iqbalaabi</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/iqbalaabi"/>
    <language>en</language>
    <item>
      <title>Why Your Tailwind Email Breaks in Outlook (and How to Inline It Properly</title>
      <dc:creator>Muhammad Iqbal</dc:creator>
      <pubDate>Mon, 12 Oct 2026 17:37:10 +0000</pubDate>
      <link>https://dev.to/iqbalaabi/why-your-tailwind-email-breaks-in-outlook-and-how-to-inline-it-properly-2a14</link>
      <guid>https://dev.to/iqbalaabi/why-your-tailwind-email-breaks-in-outlook-and-how-to-inline-it-properly-2a14</guid>
      <description>&lt;p&gt;You build an email in Tailwind. It looks perfect in the browser, fine in Gmail, and then desktop Outlook turns it into a mess.&lt;/p&gt;

&lt;p&gt;If you've been there, here's why it happens and a workflow that makes it less painful.&lt;/p&gt;

&lt;h2&gt;
  
  
  The core problem
&lt;/h2&gt;

&lt;p&gt;Tailwind classes like &lt;code&gt;px-6&lt;/code&gt; or &lt;code&gt;bg-blue-600&lt;/code&gt; don't carry any styling themselves. They point at rules in a stylesheet. Email clients don't reliably load or honor that stylesheet, and each one renders HTML with its own engine:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Flexbox and grid are unreliable in key clients&lt;/li&gt;
&lt;li&gt;Transforms, animations and advanced selectors often fail&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;rem&lt;/code&gt; units and CSS variables can behave inconsistently&lt;/li&gt;
&lt;li&gt;Media queries work in some clients and are ignored in others&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;The one thing nearly everything respects is a &lt;code&gt;style&lt;/code&gt; attribute on the element itself. That's what "inlining" gives you.&lt;/p&gt;

&lt;h2&gt;
  
  
  What inlining does
&lt;/h2&gt;

&lt;p&gt;Illustrative example:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight html"&gt;&lt;code&gt;&lt;span class="c"&gt;&amp;lt;!-- Before --&amp;gt;&lt;/span&gt;
&lt;span class="nt"&gt;&amp;lt;a&lt;/span&gt; &lt;span class="na"&gt;href=&lt;/span&gt;&lt;span class="s"&gt;"#"&lt;/span&gt; &lt;span class="na"&gt;class=&lt;/span&gt;&lt;span class="s"&gt;"bg-blue-600 text-white px-6 py-3 font-bold"&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&lt;/span&gt;Confirm email&lt;span class="nt"&gt;&amp;lt;/a&amp;gt;&lt;/span&gt;

&lt;span class="c"&gt;&amp;lt;!-- After --&amp;gt;&lt;/span&gt;
&lt;span class="nt"&gt;&amp;lt;a&lt;/span&gt; &lt;span class="na"&gt;href=&lt;/span&gt;&lt;span class="s"&gt;"#"&lt;/span&gt; &lt;span class="na"&gt;style=&lt;/span&gt;&lt;span class="s"&gt;"background-color:#2563eb;color:#ffffff;padding:12px 24px;font-weight:700;"&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&lt;/span&gt;Confirm email&lt;span class="nt"&gt;&amp;lt;/a&amp;gt;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Doing this by hand across a whole template is slow, and one missed declaration can break a section in a single client without you noticing.&lt;/p&gt;

&lt;h2&gt;
  
  
  The tricky parts
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;Responsive variants.&lt;/strong&gt; &lt;code&gt;sm:&lt;/code&gt; and &lt;code&gt;md:&lt;/code&gt; need media queries, and inline styles can't contain those. The workable approach is to inline the static utilities and keep responsive rules in a &lt;code&gt;&amp;lt;style&amp;gt;&lt;/code&gt; block. Design so the email still looks fine if those rules are ignored.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Units.&lt;/strong&gt; Convert &lt;code&gt;rem&lt;/code&gt; to &lt;code&gt;px&lt;/code&gt; using a known root font size.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Layout.&lt;/strong&gt; If a utility depends on flex or grid, plan on swapping it for a table-based structure.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Email size.&lt;/strong&gt; Inlining repeats declarations, so HTML grows. Gmail clips messages over roughly 102 KB, which can hide your footer and unsubscribe link.&lt;/p&gt;

&lt;h2&gt;
  
  
  A workflow that works
&lt;/h2&gt;

&lt;ol&gt;
&lt;li&gt;Write the template in Tailwind.&lt;/li&gt;
&lt;li&gt;Convert it to inline styles.&lt;/li&gt;
&lt;li&gt;Read the warnings and fix fragile bits.&lt;/li&gt;
&lt;li&gt;Check the output size.&lt;/li&gt;
&lt;li&gt;Test in real clients, especially Outlook.&lt;/li&gt;
&lt;li&gt;Keep the Tailwind file as your source and re-convert after every change. Don't hand-edit the inlined output.&lt;/li&gt;
&lt;/ol&gt;

&lt;h2&gt;
  
  
  Trying it with a browser-based converter
&lt;/h2&gt;

&lt;p&gt;For step 2, I built a free converter at AabiTech: the &lt;a href="https://aabitech.com/tools/tailwind-css-to-email-safe-inline-style-converter" rel="noopener noreferrer"&gt;Tailwind CSS to Email-Safe Inline Style Converter&lt;/a&gt;. It runs entirely in the browser, so your template isn't uploaded.&lt;/p&gt;

&lt;p&gt;What it does:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Supports Tailwind v3 and v4, with an Auto option&lt;/li&gt;
&lt;li&gt;Offers Conservative, Balanced and Modern Email modes&lt;/li&gt;
&lt;li&gt;Inlines static utilities and keeps responsive rules in a style block&lt;/li&gt;
&lt;li&gt;Reports unsupported classes instead of silently guessing&lt;/li&gt;
&lt;li&gt;Warns about fragile features like flexbox, grid, transforms and animation&lt;/li&gt;
&lt;li&gt;Shows size change and a Gmail 102 KB check&lt;/li&gt;
&lt;li&gt;Accepts custom theme JSON and &lt;code&gt;@theme&lt;/code&gt; variables, plus options for root font size, &lt;code&gt;!important&lt;/code&gt; on responsive overrides, and Outlook-safe table hints&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;It doesn't promise identical rendering everywhere, and neither does any converter. Treat the warnings as a to-do list, then test in the clients your audience uses.&lt;/p&gt;

&lt;p&gt;If the output is hard to read, run it through an &lt;a href="https://aabitech.com/tools/html-beautifier" rel="noopener noreferrer"&gt;HTML beautifier&lt;/a&gt;.&lt;/p&gt;

&lt;h2&gt;
  
  
  Pre-send checklist
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;[ ] No flex or grid in the layout&lt;/li&gt;
&lt;li&gt;[ ] Warnings reviewed&lt;/li&gt;
&lt;li&gt;[ ] Size comfortably under Gmail's clip limit&lt;/li&gt;
&lt;li&gt;[ ] Responsive rules are enhancements, not requirements&lt;/li&gt;
&lt;li&gt;[ ] Tested in Gmail, Outlook, Apple Mail and mobile&lt;/li&gt;
&lt;li&gt;[ ] Dark mode checked&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Over to you
&lt;/h2&gt;

&lt;p&gt;What's the worst email client bug you've fought? Do you inline at build time, or use something like MJML or a framework instead? I'd like to hear what's working for your team.&lt;/p&gt;

</description>
      <category>tooling</category>
      <category>tailwindcss</category>
      <category>browser</category>
      <category>css</category>
    </item>
  </channel>
</rss>
