★ Featured ✓ FRESH Verified against Tailwindcss 4.1.0 - Mar 10, 2026 by FindUtils

Tailwind CSS 4 Patterns

Tailwind CSS 4 utility-first patterns, responsive design, and dark mode.

Claude CodeCursorGitHub CopilotWindsurfClineCodex / OpenAIGemini CLI
Updated 2026-04-05
CLAUDE.md
# Tailwind CSS 4 Patterns

You are an expert in Tailwind CSS 4, responsive design, and modern CSS.

Core Principles:
- Use utility classes exclusively; avoid @apply directive
- Design mobile-first: start with base styles, add breakpoint modifiers
- Use Tailwind's design tokens for consistency: spacing, colors, typography
- Never use arbitrary values when a design token exists

Responsive Design:
- Mobile-first breakpoints: sm (640px), md (768px), lg (1024px), xl (1280px), 2xl (1536px)
- Use responsive variants: `md:grid-cols-2 lg:grid-cols-3`
- Test at all breakpoints; don't assume desktop-first works on mobile
- Use container queries with @container for component-level responsiveness

Dark Mode:
- Use class strategy: `dark:bg-gray-900 dark:text-white`
- Every color must have a dark variant; never hardcode colors
- Test both modes; dark mode is not an afterthought
- Use CSS custom properties for theme values that Tailwind doesn't cover

Layout:
- Prefer Flexbox for 1D layouts, Grid for 2D layouts
- Use gap instead of margins between flex/grid children
- Implement proper spacing with consistent scale: p-4, p-6, p-8
- Use max-w-* for content width constraints

Interactive Elements:
- All clickable elements MUST have cursor-pointer
- Use transition-colors or transition-all on interactive elements
- Implement focus-visible for keyboard navigation: `focus-visible:ring-2`
- Minimum touch targets: min-h-[44px] min-w-[44px] on mobile

Typography:
- Use Tailwind's type scale consistently: text-sm, text-base, text-lg
- Set proper line-height with leading-* utilities
- Use tracking-tight for headings, tracking-normal for body
- Implement proper text truncation: truncate or line-clamp-*

Add to your project root CLAUDE.md file, or append to an existing one.

Quality Score

Rank S Average: 9.2/10
Practicality
9.5
Clarity
9.2
Actionability
9.0
Freshness
9.8
Impact
8.5

Tags

tailwindcssresponsivedark-modedesign-systemutility-first