Using Colors in Tailwind CSS
Colors
Tailwind CSS provides a wide range of color utilities that you can apply to elements. These utilities help you quickly set background colors, text colors, and border colors.
Note
The numbers in these classes represent different shades of the base color. These numbers range from
50
to900
:
- Lower numbers (e.g.,
50
): Lighter shades;- Higher numbers (e.g.,
900
): Darker shades.
Background Colors
Use the bg-
prefix followed by the color name and shade.
index.html
Text Colors
Use the text-
prefix followed by the color name and shade.
index.html
Border Colors
Use the border-
prefix followed by the color name and shade.
index.html
Note
To see all the existing colors, you can refer to the Tailwind documentation below.
1. Which class would you use to set a background color to blue?
2. Which utility class would you use to set the text color to gray?
Tak for dine kommentarer!
Spørg AI
Spørg AI
Spørg om hvad som helst eller prøv et af de foreslåede spørgsmål for at starte vores chat
Spørg mig spørgsmål om dette emne
Opsummér dette kapitel
Vis virkelige eksempler
Awesome!
Completion rate improved to 3.57
Using Colors in Tailwind CSS
Stryg for at vise menuen
Colors
Tailwind CSS provides a wide range of color utilities that you can apply to elements. These utilities help you quickly set background colors, text colors, and border colors.
Note
The numbers in these classes represent different shades of the base color. These numbers range from
50
to900
:
- Lower numbers (e.g.,
50
): Lighter shades;- Higher numbers (e.g.,
900
): Darker shades.
Background Colors
Use the bg-
prefix followed by the color name and shade.
index.html
Text Colors
Use the text-
prefix followed by the color name and shade.
index.html
Border Colors
Use the border-
prefix followed by the color name and shade.
index.html
Note
To see all the existing colors, you can refer to the Tailwind documentation below.
1. Which class would you use to set a background color to blue?
2. Which utility class would you use to set the text color to gray?
Tak for dine kommentarer!