Tailwind CSS is a utility-first CSS framework used to build user interfaces by applying small, single-purpose classes directly in markup. It's aimed at frontend developers who want to style components without switching files or writing custom CSS rules, and it works with any framework or plain HTML.
Instead of writing semantic class names and separate stylesheets, you compose designs from low-level utilities like flex, pt-4, text-center, and bg-blue-500. This keeps styling colocated with markup and avoids the naming and specificity problems that come with traditional CSS architectures.
sm:, md:, lg:) let you apply utilities conditionally at different screen sizes without media query boilerplate.hover:, focus:, and dark: apply styles for interaction states and dark mode directly in class names.top-[117px]) covers one-off values that don't fit the default scale, without editing config.Tailwind fits projects where developers want fast iteration on UI without maintaining a separate CSS architecture: dashboards, marketing sites, internal tools, and component libraries built with React, Vue, Svelte, or plain HTML templates. It's a good fit for teams that want design constraints enforced through a shared config rather than through convention alone.
It's also useful for prototyping, since you can style elements directly in markup without opening a stylesheet, and for design systems where a config file becomes the single source of truth for spacing, color, and typography scales.
It's less of a fit if a project needs to ship hand-authored semantic CSS for reasons like extremely tight CSS payload budgets on legacy browsers, or if a team strongly prefers separating markup and style for handoff to designers who edit CSS directly. Long lists of utility classes in markup can also feel noisy to developers used to BEM or component-scoped CSS, so teams that value minimal class attributes may prefer a different approach.
Install Tailwind CSS via npm alongside your build tool:
npm install tailwindcss
Generate a config file:
npx tailwindcss init
Add the paths to your template files in tailwind.config.js so Tailwind knows which files to scan for class names:
module.exports = {
content: ["./src/**/*.{html,js,jsx,ts,tsx}"],
theme: {
extend: {},
},
plugins: [],
}
Add the Tailwind directives to your main CSS file:
@tailwind base;
@tailwind components;
@tailwind utilities;
Build the CSS using the CLI:
npx tailwindcss -i ./src/input.css -o ./dist/output.css --watch
Alternatively, add tailwindcss as a PostCSS plugin in postcss.config.js if your build tool (Vite, webpack, etc.) already runs PostCSS. Full setup guides for specific frameworks are on the official documentation site.