Lesson list · Lesson 1 of 3

Foundations · Lesson 1 of 3

Utility-First in Practice

Style a button with small single-purpose classes instead of writing custom CSS.

1 min 0 comments

Each utility class does one thing: px-5 adds horizontal padding, rounded-full rounds the corners. Combine them and you have a component.

<button class="rounded-full bg-pink-500 px-5 py-2 font-semibold text-white hover:bg-pink-600">Save</button>

Why it works

You never have to invent class names, and changing one button never breaks another page.

Discussion

Log in to join the conversation. Log in

No discussion here yet. Be the first to ask.