Tailwind CSS·Tailwind from utilities to design system

Setup and utility-first CSS

Install Tailwind and understand why utilities beat one-off class names.

Intermediate 12 min read Lesson 1 of 300 Challenge included
What you will be able to do
  • Install tailwindcss and configure the content paths.
  • Add the Tailwind directives to your stylesheet.
  • Keep the design scale instead of arbitrary values.
  • Extract only when a pattern repeats.

In plain English

A utility class does one thing. Composition happens in the markup, so you stop inventing names and deleting dead CSS. The trade-off is verbose markup, which components and @apply solve when a pattern repeats.

input.cssCSS
@tailwind base;
@tailwind components;
@tailwind utilities;

.card {
  @apply rounded-xl border border-slate-200 bg-white p-6 shadow-sm;
}
Your turn

Style a card

Easy

Create a div with rounded corners, padding, a border and a subtle shadow using utilities.

HTML · starter
<div class="">
Check your understanding before moving on.
Knowledge checkQuestion 1

What is the main trade-off of utility-first CSS?

Select an answer to continue
Study tools

Make it yours.

Keep a private note for this lesson, then turn the key ideas into flashcards you can revisit.

Sign in to save notes and flashcards.Both are private to your account and stay with your progress.
Sign in
Finished reading?

Lock in what you just learned.

Mark this lesson complete to save your place and move one step closer to the certificate.

Lesson 1 of 300 · 0% of course