Challenge - 5 Problems
Gradient Guru
Get all challenges correct to earn this badge!
Test your skills under time pressure!
❓ rendering
intermediate2:00remaining
What color gradient will this Tailwind CSS code produce?
Consider the following Tailwind CSS classes applied to a div:
What is the visual gradient direction and color sequence you will see?
class="bg-gradient-to-r from-red-500 via-yellow-300 to-green-500"
What is the visual gradient direction and color sequence you will see?
Tailwind
<div class="bg-gradient-to-r from-red-500 via-yellow-300 to-green-500 h-24 w-full"></div>Attempts:
2 left
💡 Hint
The class 'bg-gradient-to-r' means the gradient goes to the right (horizontal).
✗ Incorrect
The 'bg-gradient-to-r' sets the gradient direction from left to right. The colors start with 'from-red-500', pass through 'via-yellow-300', and end with 'to-green-500'. So the gradient flows horizontally from red to yellow to green.
📝 Syntax
intermediate1:30remaining
Which Tailwind CSS class is invalid for gradient colors?
Which of the following Tailwind CSS classes will cause an error or not apply a gradient color properly?
Attempts:
2 left
💡 Hint
Check if all gradient color classes have a valid color and shade after 'via'.
✗ Incorrect
Option D has 'via' without a color or shade specified, which is invalid and will not apply the gradient correctly. All gradient color utilities require a valid color class after 'from', 'via', or 'to'.
🧠 Conceptual
advanced1:30remaining
How does the 'via' color affect a Tailwind CSS gradient?
In Tailwind CSS gradients, what role does the 'via' color play compared to 'from' and 'to' colors?
Attempts:
2 left
💡 Hint
Think about how gradients blend colors smoothly.
✗ Incorrect
The 'via' color is an intermediate stop in the gradient. It creates a smooth transition from the 'from' color to the 'to' color by adding a middle color stop.
❓ selector
advanced1:30remaining
Which Tailwind CSS class combination creates a vertical gradient from blue to pink with a purple middle?
You want a vertical gradient that starts with blue, passes through purple, and ends with pink. Which class set achieves this?
Attempts:
2 left
💡 Hint
'to-b' means the gradient goes from top to bottom (vertical).
✗ Incorrect
The class 'bg-gradient-to-b' sets a vertical gradient from top to bottom. 'from-blue-500' starts the gradient with blue at the top, 'via-purple-600' adds purple in the middle, and 'to-pink-400' ends with pink at the bottom.
❓ accessibility
expert2:00remaining
What accessibility consideration is important when using Tailwind CSS gradients with 'from', 'via', and 'to' colors?
When applying gradients using 'from', 'via', and 'to' colors in Tailwind CSS, which accessibility practice is most important to ensure good readability?
Attempts:
2 left
💡 Hint
Think about how users with vision difficulties read text over backgrounds.
✗ Incorrect
Good contrast between text and background is essential for readability and accessibility. Gradients can reduce contrast if colors are too similar or light, so choose colors carefully to maintain clear text visibility.