How to Convert Tailwind CSS Classes to Regular CSS
Tailwind CSS uses utility classes like 'flex items-center gap-4 p-6 rounded-lg bg-white shadow-md' instead of writing custom CSS. But sometimes you need the equivalent standard CSS โ for email templates that can't use Tailwind, for understanding what a class does, or for extracting styles from a Tailwind project.
- Convert Tailwind utility classes to standard CSS properties.
- Covers common tailwind to css conversions.
- Covers responsive and state classes.
- Covers using the converter tool.
- When to Convert Tailwind to CSS.
Common Tailwind to CSS Conversions
Layout: flex โ display: flex. grid โ display: grid. items-center โ align-items: center. justify-between โ justify-content: space-between. gap-4 โ gap: 1rem.
Spacing: p-4 โ padding: 1rem. m-2 โ margin: 0.5rem. px-6 โ padding-left: 1.5rem; padding-right: 1.5rem. mt-8 โ margin-top: 2rem.
Sizing: w-full โ width: 100%. h-screen โ height: 100vh. max-w-lg โ max-width: 32rem.
Tailwind's spacing scale is based on 0.25rem increments: 1 = 0.25rem, 2 = 0.5rem, 4 = 1rem, 8 = 2rem.
Responsive and State Classes
Tailwind prefixes handle responsive breakpoints and states: md:flex โ @media (min-width: 768px) { display: flex; }. hover:bg-blue-600 โ :hover { background-color: #2563eb; }. dark:bg-gray-900 โ @media (prefers-color-scheme: dark) { background-color: #111827; }. The Tailwind to CSS tool converts all of these prefixed classes to their standard CSS equivalents.
auto-fill and auto-fit behave differently when there are fewer items than columns. Use auto-fill to keep empty tracks; auto-fit to collapse them.Using the Converter Tool
Paste any Tailwind class string into the Tailwind to CSS tool and get the equivalent CSS properties instantly. This is useful for learning what unfamiliar classes do, converting Tailwind prototypes to vanilla CSS, and building email templates where only inline CSS works.
width, height, top, or left. These trigger layout recalculations on every frame and can drop performance below 60fps.When to Convert Tailwind to CSS
Email templates (most email clients don't support external stylesheets or utility classes). Third-party widget embeds where you can't include Tailwind's stylesheet. Documentation where you need to show standard CSS. Migrating away from Tailwind to a custom CSS architecture. Understanding a colleague's Tailwind code when you're more comfortable with standard CSS.