Tailwind CSS Tutorial
Learn Tailwind CSS step by step: 37 lessons in 9 chapters with examples, quizzes, diagrams and projects.
Start learning →
of lessons completed
Getting Started
- What Is Tailwind CSS? Learn what Tailwind CSS v4 is, how utility-first styling differs from writing your own CSS classes, and when it is a good fit for your project.
- Installing Tailwind CSS Set up Tailwind CSS v4 with the Vite plugin, the standalone CLI, PostCSS or the browser build, and learn which method fits which project.
- Your First Tailwind Page Build a profile card and a small landing page with Tailwind CSS utilities, reading each class so you learn how spacing, color, type and layout fit together.
- The Utility-First Workflow Understand how utility-first CSS changes the way you build: no class naming, local edits, reuse through components, and how to keep long class lists readable.
- How Tailwind CSS Works See how Tailwind v4 finds class names, generates only the CSS you use, orders utilities with cascade layers and exposes design tokens as CSS variables.
Utility Basics
- Spacing: Padding, Margin and Gap Master Tailwind v4 spacing: the 0.25rem scale, padding and margin utilities for every side, negative margins, space-x and space-y, and gap.
- Sizing: Width and Height Control element dimensions with Tailwind v4: spacing-scale sizes, fractions, full and screen units, min and max limits, size-* and container-based max widths.
- Borders, Rings and Outlines Style element edges in Tailwind v4: border width, color and style, rounded corners, divide lines, ring utilities and accessible focus outlines, with v3 differences.
- Backgrounds and Gradients Use Tailwind v4 background utilities: colors with opacity, images, size and position, linear, radial and conic gradients with from, via and to stops.
- Arbitrary Values and !important Break out of the Tailwind scale when you must: square-bracket values, CSS variable shorthand, arbitrary properties and variants, and the important modifier.
Layout with Flexbox and Grid
- Display, Position and Overflow Learn how Tailwind v4 controls display types, relative, absolute, fixed and sticky positioning, inset and z-index, overflow, visibility and screen-reader-only text.
- Flexbox With Tailwind CSS Build one-dimensional layouts with Tailwind v4 flexbox utilities: direction, justify and items alignment, wrapping, gap, grow, shrink, basis and order.
- CSS Grid With Tailwind CSS Create two-dimensional layouts with Tailwind v4 grid utilities: grid-cols and grid-rows, col-span, auto-flow, responsive card grids, auto-fill and subgrid.
- Page Layout Patterns Put flexbox and grid together: centered containers, sticky footers, sidebar and dashboard layouts, equal-height cards, media objects and split screens in Tailwind.
Typography, Color and Effects
- Fonts, Text and Typography Utilities Style text with Tailwind v4: font families, the size scale with built-in line heights, weight, tracking, alignment, decoration, wrapping, line-clamp and lists.
- Colors and Opacity Use Tailwind v4's OKLCH color palette on text, backgrounds, borders and SVG; apply the slash opacity modifier; understand currentColor and contrast.
- Shadows, Filters and Backdrop Effects Add depth and effects with Tailwind v4: box shadows, colored and inset shadows, drop-shadow, text-shadow, blur and color filters, frosted glass and blend modes.
- Transitions and Transforms Animate state changes in Tailwind v4: transition properties, duration, easing and delay, plus scale, rotate, translate, 3D transforms and reduced-motion support.
Responsive Design and State Variants
- Responsive Design with Breakpoints Learn how Tailwind CSS builds responsive layouts mobile-first with sm, md, lg, xl and 2xl prefixes, max-width variants, ranges and arbitrary breakpoints.
- State Variants: Hover, Focus and More Style hover, focus, active, disabled, first, last, odd and placeholder states in Tailwind CSS with variant prefixes, and learn how to stack variants safely.
- Group, Peer and Has Variants Style one element from the state of another in Tailwind CSS: group-hover, peer-checked, named groups and the has-, in- and not- variants, with live demos.
- Container Queries and More Variants Use Tailwind CSS container queries with @container and @md, plus aria-, data-, supports-, motion-safe, print and starting variants for adaptive components.
Dark Mode and Theming
- Dark Mode in Tailwind CSS Add dark mode to a Tailwind CSS site with the dark: variant, follow the system setting, switch to a class or data-attribute toggle and remember the choice.
- The @theme Directive and Design Tokens Understand the Tailwind CSS v4 @theme directive: theme variable namespaces, how variables become utilities, CSS variables you can reuse, and @theme inline.
- Custom Colors, Fonts and Spacing Build a brand palette with OKLCH, add custom fonts and a type scale, tune spacing and radius, and extend Tailwind CSS v4 without losing the defaults.
- Multiple Themes with CSS Variables Build switchable themes in Tailwind CSS v4: semantic color variables, @theme inline, data-theme attributes, dark mode without dark: prefixes and color-mix tints.
Components and Reuse
- Reusing Styles with Components Handle repeated Tailwind CSS class lists the right way: loops, partials, components, variant maps for buttons, and when copy-and-paste is actually fine.
- Base and Component Layers with @apply Add your own CSS to Tailwind v4 safely: @layer base and components, @apply, preflight, how utilities override component classes and when to avoid @apply.
- Custom Utilities and Variants Create your own Tailwind CSS v4 utilities with @utility, functional utilities using --value(), custom variants with @custom-variant and @slot, and plugins.
- Arbitrary Values and Resolving Conflicts Use Tailwind CSS square-bracket arbitrary values and properties, CSS variable shorthands, the important modifier and prefix, and avoid dynamic class name mistakes.
Animation and Advanced Features
- Keyframe Animations in Tailwind CSS Use Tailwind CSS built-in animations (spin, ping, pulse, bounce) and define your own @keyframes inside @theme to build loaders, skeletons, wiggles and attention effects.
- Filters, Gradients, Masks and Shadows Create depth and polish with Tailwind CSS v4: linear, radial and conic gradients, blur and backdrop-blur, drop shadows, text shadows, masks and gradient text.
- Build Tools, Optimization and Upgrading from v3 Set up Tailwind CSS v4 with Vite, the CLI or PostCSS, understand automatic content detection and @source, and upgrade from v3 with the official tool and renamed utilities.
Projects and Practice
- Project: A Responsive Landing Page Build a complete responsive landing page with Tailwind CSS step by step: a mobile navigation, hero section, feature grid, pricing teaser, call to action and footer.
- Project: An Admin Dashboard Build a responsive admin dashboard with Tailwind CSS: sidebar and top bar layout, stat cards, a data table, progress bars, status badges and a dark mode switch.
- Project: Signup Form and Pricing Cards Build an accessible signup form and pricing cards with Tailwind CSS: input states, validation messages, a password strength meter, plan selection with peer and has.
- Practice, Common Mistakes and Cheat Sheet Practice Tailwind CSS with three guided exercises, learn the ten most common mistakes and keep a compact cheat sheet of breakpoints, variants, theme namespaces and directives.