Setup and utility-first CSS
Install Tailwind and understand why utilities beat one-off class names.
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.
@tailwind base;
@tailwind components;
@tailwind utilities;
.card {
@apply rounded-xl border border-slate-200 bg-white p-6 shadow-sm;
}Your turn
EasyStyle a card
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 inFinished reading?
Lock in what you just learned.
0%
Mark this lesson complete to save your place and move one step closer to the certificate.