Tailwind CSS Course
Tailwind CSS
/
Intermediate

Gradients

Definition

Utilities for creating background gradients using a combination of direction, from, via, and to colors.

Explain Like I'm New

A smooth transition between colors. You define three things: 1. Direction (`bg-gradient-to-r` for Right). 2. Starting Color (`from-purple-500`). 3. Ending Color (`to-pink-500`).

Real World Example

A striking Instagram-style logo background or a 'Web3/Crypto' style landing page hero section.

Common Use Cases

  • •Modern UI aesthetics
  • •Hero sections
  • •Premium tier badges

Interactive Example

Interview Questions

basic

  • If you want a gradient to fade from Top to Bottom, what direction class do you use?

intermediate

  • What happens if you define a `from-*` color, but forget to define a `to-*` color?

Flash Cards

Question

Top to bottom?

Click to reveal answer
Answer

`bg-gradient-to-b` (to-bottom).

Question

Forget to-* color?

Click to reveal answer
Answer

Tailwind automatically fades the `from-*` color into a fully transparent version of itself, so it gracefully disappears into whatever background is underneath it.