Tailwind CSS Course
Tailwind CSS
/
Beginner

Background Colors

Definition

Utilities for controlling an element's background color.

Explain Like I'm New

Works exactly like text colors, but uses the `bg-` prefix instead. `bg-{color}-{shade}`.

Real World Example

Creating a primary action button with `bg-blue-600 text-white`.

Common Use Cases

  • •Buttons
  • •Card backgrounds
  • •Page backgrounds

Interactive Example

Interview Questions

basic

  • What prefix is used for background colors in Tailwind?

intermediate

  • What class would you use to make a background completely transparent?

Flash Cards

Question

Prefix?

Click to reveal answer
Answer

`bg-` (e.g., `bg-red-500`).

Question

Transparent class?

Click to reveal answer
Answer

`bg-transparent`. This is incredibly useful when overriding a background color on a hover state or specific responsive breakpoint.