Tailwind CSS is a build-time CSS framework: it scans your project’s source for class names, generates the corresponding CSS, and lets you compose single-purpose utilities directly in markup. To use it in a real project, install it through the integration that fits your framework or build pipeline, import the generated stylesheet, then build layouts with utilities and variants. The steps below focus on the current documentation surfaced for Tailwind CSS v4; check your installed version and use its matching docs before applying version-specific commands.
How does Tailwind CSS work?
Tailwind’s build process detects class candidates in source files and emits CSS for the candidates it finds. The result is a static stylesheet that your page loads; Tailwind is not a runtime styling engine. In your templates or components, utilities compose styling on each element: for example, classes can set layout, spacing, typography, and color together. A utility generally represents one property or behavior, while variants such as hover: and focus: make a utility conditional on a state or other condition. Tailwind’s utility-class guide explains this model.
Utilities cover common styling needs, but they do not prohibit custom CSS. Theme variables, custom utilities and variants, and ordinary CSS provide extension paths when a project needs a reusable design token or behavior that is not a good fit for an existing utility.
How do I install Tailwind CSS?
Choose an integration that matches the project you already have rather than introducing a separate build pipeline by default. Official setup routes include Vite, PostCSS, the Tailwind CLI, and framework-specific guides. This guide does not give a single install command because the correct packages and configuration depend on that choice and the Tailwind version. Follow the matching official guide for your project: Vite or the broader framework guides.
Recommended Free Tools
#1 Best Overall
- Check the project first. Identify its framework, bundler, stylesheet entry point, and installed Tailwind version. Use documentation for that version, not a command copied from a guide for another release.
- Install through the matching integration. Follow the official steps for Vite, PostCSS, CLI, or your framework. Framework integrations may manage stylesheet inclusion for you.
- Import Tailwind and connect the output stylesheet. Ensure the compiled CSS is included by the page or application entry point. A successful build alone does not apply styles if the resulting stylesheet is never loaded.
- Run the project’s normal build or development command. Add a few utility classes to a rendered element and verify the expected styles in the browser. If nothing changes, check stylesheet inclusion and whether the class appears in a source file Tailwind scans.
The Play CDN is useful for trying Tailwind in a browser without setting up a project build, but Tailwind says it is for development, not production.
How do I use Tailwind CSS utilities and variants?
Build a component by composing utilities that express its layout and visual treatment on the element that needs them. For example, a card can use layout utilities, padding, rounded corners, a background color, and text styles together. Add a variant when a utility should apply only under a condition: hover: for a hover state, focus: for focus, or a responsive prefix for a viewport threshold. Variants can be stacked to express combined conditions; use them to make the condition explicit rather than duplicating whole stylesheets for each state.
When the same group of classes becomes difficult to maintain across repeated markup, decide whether the repetition belongs in a component, a reusable design token, a custom utility, or custom CSS. Keep one-off arbitrary values for genuine exceptions; if a value is part of the design system, define and reuse it through theme variables instead. Tailwind documents both theme variables and custom styles.
How do Tailwind breakpoints work?
Tailwind’s responsive utilities are mobile-first. An unprefixed utility defines the base style; a breakpoint prefix applies from that breakpoint’s minimum width upward, and normally remains active at larger widths. If a style should apply only within a bounded width range, use a range-limiting variant rather than assuming a prefix turns off at the next breakpoint. The documented default thresholds are:
Rank #3
| Prefix | Minimum width |
|---|---|
sm: |
40rem (640px) |
md: |
48rem (768px) |
lg: |
64rem (1024px) |
xl: |
80rem (1280px) |
2xl: |
96rem (1536px) |
These are Tailwind’s documented defaults, not a requirement for every project’s design. Check the current responsive design documentation if your project customizes breakpoints or needs container-query behavior.
How do I enable dark mode in Tailwind CSS?
By default, the dark: variant follows the user’s operating-system or browser color preference through prefers-color-scheme. This suits an interface that should follow system settings automatically. If the app needs a user-controlled theme, redefine the variant to respond to a class or data attribute, then have application code manage that selector. Tailwind’s dark mode guide shows the supported configuration pattern; confirm its syntax against the docs for your installed version.
Rank #4
What should I check before adopting Tailwind CSS v4?
Compatibility depends on both the Tailwind release and the project’s target browsers and CSS toolchain. Tailwind Labs’ compatibility page specifies the core browser floor for v4.0 as Chrome 111, Safari 16.4, and Firefox 128. Those requirements are for v4.0; do not assume they describe every Tailwind release. The same page says v4 is not designed for Sass, Less, or Stylus. If your project depends on those preprocessors or supports older browsers, check the exact version’s compatibility guidance before migrating. See Tailwind’s compatibility documentation.
Common setup and styling problems
- Utilities have no visible effect: confirm the compiled stylesheet is imported and loaded by the page. Then verify that the class is present in a source file Tailwind scans and that the build process runs for that file.
- Styles work locally but not in the deployed build: inspect the production build’s stylesheet inclusion and source detection. The generated stylesheet only includes candidates Tailwind detects during its build.
- A responsive style persists above the size you expected: breakpoint prefixes apply from their minimum width upward. Use a range-limiting variant when the condition must stop at a larger threshold.
- Dark styling does not follow the app’s theme toggle: the default trigger follows system color preference. Configure the dark variant around the class or data attribute your application controls, then ensure app code changes that selector.
- The install command or configuration does not match the project: identify the installed Tailwind version and framework/build setup, then follow the corresponding official integration guide. Avoid mixing instructions from different major versions.
Or skip the browser setup
If you need screenshots of rendered pages while developing or automating visual checks, ScreenshotNeo is a website screenshot API and MCP server. One GET request can return an image or PDF; its capture workflow accepts cookie banners and removes more than 60 known consent platforms, newsletter popups, and chat widgets before taking the shot, with each step individually switchable. Bot checks, blank pages, timeouts, failed loads, and cache hits are not billed, and response headers identify the page verdict and billing status. AI agents can use its MCP tools, including take_screenshot, get_page_info, and capture_pdf.
Do these 3 things before closing this tab:
1Fix the driver behind crashes, sound loss and screen glitches2Repair Windows errors before they cause bigger problems3Scan for outdated or missing drivers - takes under a minuteWith an API key, a cURL capture looks like this (see the ScreenshotNeo documentation):
Best Value
curl -G "https://api.screenshotneo.com/v1/shot" -d access_key=YOUR_API_KEY --data-urlencode url=https://stripe.com -o shot.webp
The Free plan includes 1,000 screenshots a month with no card; paid plans start at $5 for 3,000 shots. Sign up for ScreenshotNeo’s free plan to try it.
Quick Recap
Product prices and availability are accurate as of the date/time indicated and are subject to change. Any price and availability information displayed on Amazon at the time of purchase will apply.




