Skip to main content
Tailwindcss6

Tailwind CSS

Tailwind CSS is a utility-first CSS framework for building interfaces by combining atomic utility classes.

Core Philosophy

Unlike traditional semantic CSS frameworks, Tailwind provides low-level utility classes so you can style directly in HTML.

Installation

Via npm

Configuration File

CSS File

Vite Project

Common Utility Classes

Layout

Space

Sizing

Colors

Typography

Borders and border radius

Shadows

Opacity

Responsive Design

Tailwind uses a mobile-first breakpoint system.

Breakpoints

  • sm: 640px
  • md: 768px
  • lg: 1024px
  • xl: 1280px
  • 2xl: 1536px

Pseudo-classes & States

Dark Mode

Custom Configuration

Extend Theme

Custom Utilities

Custom Components

Common Plugins

Official Plugins

Typography(Typography)

Practical Tips

Extract Components

Use @apply to extract repeated utility classes:

Conditional Classes

Use the clsx or classnames library:

Group & Children

Arbitrary Values

Performance Optimization

Production Optimization

Tailwind automatically removes unused styles.

JIT Mode

Just-In-Time mode is enabled by default and generates styles on demand.

Editor Support

VS Code Extensions

  • Tailwind CSS IntelliSense: autocomplete and previews
  • Headwind: automatically sorts class names

FAQ

Style Priority

Use the ! prefix to force a style to apply:

Custom Colors

Best Practices

  1. Stay consistent and follow the design system.
  2. Avoid over-abstraction and do not extract components too early.
  3. Use responsive design with a mobile-first mindset.
  4. Use configuration well for custom theme colors and spacing.
  5. Use editor support by installing the IntelliSense extension.
  6. Componentize complex UI by extracting it into separate files.

References

Last modified on April 17, 2026