Skip to main content
Frontend Engineering

Tailwind CSS Utilities & Layouts

Essential

Utility classes, responsive design breakpoints, dark mode variants, arbitrary values, flexbox, and grid patterns.

Instant Copy & SearchProduction Flagged SyntaxCurrent Flag Reference

Tailwind CSS Utilities & Layouts Interactive Command Directory

Browse, search, and copy battle-tested commands & syntax recipes (16 Total Commands).

16+ Verified Recipes
Flexbox Alignmentflex items-center justify-between
className="flex items-center justify-between gap-4"

Horizontal flex container with centered vertical alignment and space between items.

Responsive CSS Gridgrid-cols-1 lg:grid-cols-3
className="grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-3 gap-6"

1-column layout on mobile, 2-column on tablet, and 3-column on desktop.

Dark Mode Supportdark:bg-*
className="bg-[#F8FAFD] dark:bg-[#131314] text-[#1F1F1F] dark:text-[#E3E3E3]"

Smooth dark mode theme switching using dark: variant prefix.

Card Stylingrounded-3xl border shadow
className="p-6 rounded-3xl bg-white dark:bg-[#1E1F20] border border-[#E1E3E1] dark:border-[#2E2F31] shadow-2xs hover:border-[#4285F4] transition-all"

Premium modern card container with subtle borders, shadows, and hover transitions.

Arbitrary Values[...]
className="w-[calc(100%-2rem)] min-h-[420px] bg-[#1967D2]/10"

Pass custom CSS formulas, pixel measurements, and hex opacity values directly.

Typography Clampline-clamp-2
className="text-sm text-[#444746] dark:text-[#C4C7C5] line-clamp-2 leading-relaxed"

Truncate multi-line text to exactly 2 lines with trailing ellipsis.

Peer State Modifierspeer-checked, peer-disabled
className='peer-checked:bg-blue-600 peer-disabled:opacity-50'

Style an element conditionally based on the state of a sibling element marked with peer.

Group Modifiersgroup, group-hover
className='group hover:bg-slate-50 [&:hover_.child]:text-blue-600'

Trigger styling on nested child elements when hovering over a designated parent group wrapper.

Radial Gradientsbg-radial-[...]
className='bg-radial-[at_25%_25%] from-white to-zinc-900'

Tailwind v4 native CSS radial gradients and directional color stops.

Glassmorphismbackdrop-blur-md
className='backdrop-blur-md bg-white/70 dark:bg-black/60 sticky top-0 z-50'

Modern translucent blurred backdrop navigation bar styling with dark mode support.

Arbitrary Grid Layoutsgrid-cols-[...]
className='grid grid-cols-[repeat(auto-fit,minmax(280px,1fr))] gap-4'

Responsive auto-fitting grid track definitions without media query breakpoints.

Skeleton Animationsanimate-pulse
className='animate-pulse bg-slate-200 dark:bg-slate-700 rounded-lg h-32'

Built-in pulse animation simulating content loading state for skeleton cards.

Accessible Focus Ringsfocus-visible:outline
className='focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-blue-500'

High-contrast keyboard navigation focus outlines adhering to WCAG 2.1 accessibility rules.

Child Dividersdivide-y
className='divide-y divide-slate-200 dark:divide-slate-800'

Apply border separators between all immediate child elements automatically.

Typography Proseprose, prose-invert
className='prose dark:prose-invert max-w-none'

Apply beautiful typographic hierarchy and margins to rendered Markdown articles.

CSS Theme Configuration@theme
@theme { --font-display: 'Inter', sans-serif; --color-brand: #4285F4; }

Tailwind CSS v4 CSS-first design token and custom variable declaration.

Zero Setup100% In-Browser Execution

Companion Developer Tools & Playgrounds

Accelerate command execution and syntax debugging with HelloAIHub suite of interactive tools.

Explore all developer tools

Tailwind CSS Utilities & Layouts: Command Groups & Quick Index

16 indexed entries across 16 sections
Flexbox Alignment1 items
Responsive CSS Grid1 items
Dark Mode Support1 items
Card Styling1 items
Arbitrary Values1 items
Typography Clamp1 items
Peer State Modifiers1 items
Group Modifiers1 items
Radial Gradients1 items
Glassmorphism1 items
Arbitrary Grid Layouts1 items
Skeleton Animations1 items
Accessible Focus Rings1 items
Child Dividers1 items
Typography Prose1 items
CSS Theme Configuration1 items

Highlighted Flags & Syntax Examples in Tailwind CSS Utilities & Layouts

className="flex items-center justify-between gap-4"

Horizontal flex container with centered vertical alignment and space between items.

Flags: flex items-center justify-between
className="grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-3 gap-6"

1-column layout on mobile, 2-column on tablet, and 3-column on desktop.

Flags: grid-cols-1 lg:grid-cols-3
className="bg-[#F8FAFD] dark:bg-[#131314] text-[#1F1F1F] dark:text-[#E3E3E3]"

Smooth dark mode theme switching using dark: variant prefix.

Flags: dark:bg-*
className="p-6 rounded-3xl bg-white dark:bg-[#1E1F20] border border-[#E1E3E1] dark:border-[#2E2F31] shadow-2xs hover:border-[#4285F4] transition-all"

Premium modern card container with subtle borders, shadows, and hover transitions.

Flags: rounded-3xl border shadow

Frequently Asked Questions

Expert recommendations, common traps, and production best practices for Tailwind CSS Utilities & Layouts.

How does Tailwind CSS eliminate unused CSS in production?

Tailwind scans all your source files (.tsx, .jsx, .html) for exact class name strings at build time and generates a minimal CSS stylesheet containing only the classes actually referenced in your code, keeping production bundles typically under 20KB.

What is the difference between class-based and media-based dark mode?

Media-based dark mode relies on the operating system's 'prefers-color-scheme'. Class-based dark mode (selector strategy) toggles a '.dark' class on the root <html> or <body> element, giving users manual control via an in-app theme toggle.

What are the major architectural differences between Tailwind CSS v3 and Tailwind v4?

Tailwind v4 is rewritten using Oxide (a high-performance Rust engine) delivering 10x faster builds. It eliminates 'tailwind.config.js' in favor of CSS-first '@theme' directives in your main stylesheet, uses native CSS cascade layers, and supports modern CSS features (Container Queries, native color-mix, subgrid) out of the box.

How does the 'group' and 'peer' modifier work for conditional parent-child and sibling styling?

'group' is placed on a parent container, allowing descendants to apply styles when the parent changes state (e.g. 'group-hover:text-blue-500'). 'peer' is placed on an earlier sibling element (like a checkbox), allowing subsequent siblings to style themselves based on the peer's state (e.g. 'peer-checked:block').

Why should you use clsx and twMerge (tailwind-merge) when constructing dynamic class strings?

'clsx' conditionally joins class strings together. However, if a component receives conflicting classes (e.g. 'p-4' and 'p-6'), standard string concatenation leaves both classes in the DOM, where CSS rule order dictates the winner. 'twMerge' intelligently resolves Tailwind utility conflicts by removing overridden classes (keeping only 'p-6').

How does Tailwind CSS JIT (Just-In-Time) compiler detect class names in source code?

The JIT compiler uses regular expressions to scan all project source files (HTML, JSX, TSX, Vue) looking for tokens that match candidate class syntax. Because it performs raw string matching without evaluating JavaScript code, dynamic string interpolation like 'bg-' + color fails; classes must be written as complete string literals.

Cross-Hub Skill Acceleration

Combine command lookups with active coding interviews and complete career paths.

Need More Cheat Sheets?

Explore developer cheat sheets and syntax guides on HelloAIHub.

Browse All Cheat Sheets