Notice: This page requires JavaScript to function properly.
Please enable JavaScript in your browser settings or update your browser.
Lära Utility Classes Basics | Section
Tailwind CSS for React Development

bookUtility Classes Basics

Svep för att visa menyn

Tailwind CSS provides small utility classes to control spacing, colors, and text styles directly in your markup.

Spacing

<div className="p-4 m-2">
  Content
</div>
  • p-4: adds padding inside the element;
  • m-2: adds margin outside the element.

Colors

<div className="bg-blue-500 text-white">
  Content
</div>
  • bg-blue-500: sets background color;
  • text-white: sets text color.

Text Styling

<p className="text-lg font-bold">
  Hello World
</p>
  • text-lg: increases text size;
  • font-bold: makes text bold.

Utility classes control one style at a time, and you combine them to build the final appearance.

question mark

Which statement correctly describes a Tailwind CSS utility class and its effect?

Vänligen välj det korrekta svaret

Var allt tydligt?

Hur kan vi förbättra det?

Tack för dina kommentarer!

Avsnitt 1. Kapitel 2

Fråga AI

expand

Fråga AI

ChatGPT

Fråga vad du vill eller prova någon av de föreslagna frågorna för att starta vårt samtal

Avsnitt 1. Kapitel 2
some-alt