---
name: tailwind-css-patterns
description: Comprehensive Tailwind CSS utility-first styling patterns including responsive design, layout utilities, flexbox, grid, spacing, typography, colors, and modern CSS best practices. Use when styling React/Vue/Svelte components, building responsive layouts, implementing design systems, or optimizing CSS workflow.
language: html,tsx,jsx,vue,svelte
framework: tailwindcss
license: MIT
---
# Tailwind CSS Development Patterns
Expert guide for building modern, responsive user interfaces with Tailwind CSS utility-first framework. Covers v4.1+ features including CSS-first configuration, custom utilities, and enhanced developer experience.
## When to Use
- Styling React/HTML components with utility classes
- Building responsive layouts with breakpoints
- Implementing flexbox and grid layouts
- Managing spacing, colors, and typography
- Creating custom design systems
- Optimizing for mobile-first design
- Building dark mode interfaces
## Core Concepts
### Utility-First Approach
Apply styles directly in markup using utility classes:
```html
```
### Responsive Design
Mobile-first breakpoints with prefixes:
```html
```
Breakpoint prefixes:
- `sm:` - 640px and above
- `md:` - 768px and above
- `lg:` - 1024px and above
- `xl:` - 1280px and above
- `2xl:` - 1536px and above
## Layout Utilities
### Flexbox Layouts
Basic flex container:
```html
Left
Center
Right
```
Responsive flex direction:
```html
Item 1
Item 2
Item 3
```
Common flex patterns:
```html
Centered Content
LeftRight
Item 1
Item 2
```
### Grid Layouts
Basic grid:
```html
Column 1
Column 2
Column 3
```
Responsive grid:
```html
Item 1
Item 2
Item 3
Item 4
```
Auto-fit columns:
```html
```
### Container & Max Width
Centered container with max width:
```html
Text with relaxed line height and wide letter spacing
```
### Text Alignment
```html
Left aligned on mobile, centered on tablet+
```
## Colors
### Background Colors
```html
Blue background
Light gray background
Gradient background
```
### Text Colors
```html
Dark text
Blue text
Error text
```
### Opacity
```html
Semi-transparent blue
```
## Interactive States
### Hover States
```html
Hover link
```
### Focus States
```html
```
### Active & Disabled States
```html
```
### Group Hover
```html