Skip to main content

Practices for Tailwind CSSs

Practices for Tailwind CSS are habits that keep a project accessible, fast and tidy. They include using semantic HTML, visible focus states and sufficient contrast, ordering classes with a formatter plugin, and keeping the production CSS small by avoiding dynamically built class names. They matter as a codebase and team grow.

Stage: Quality · Part of the Tailwind CSS roadmap · Last reviewed 19 November 2026

What to learn in Practices

Practices interview questions

Why does bg-${color}-500 fail in Tailwind?

Tailwind finds class names by scanning source files as plain text, so it cannot evaluate a template string at build time and never generates that CSS. Write the complete class names, or map values to full class strings in an object, so the scanner sees them.

Does Tailwind hurt accessibility?

Not by itself. Tailwind only styles elements, so accessibility depends on your markup. Use semantic HTML, keep focus indicators, give enough contrast, support reduced motion and add labels. Utilities such as sr-only and focus-visible exist to help with these.

Where Practices fits in the Tailwind CSS roadmap

Practices belongs to the Quality stage (intermediate level). Maintain it.

Back to the full Tailwind CSS roadmap