Challenge - 5 Problems
Tailwind Arbitrary Values Master
Get all challenges correct to earn this badge!
Test your skills under time pressure!
🧠 Conceptual
intermediate2:00remaining
Why use arbitrary values in Tailwind CSS?
Which of the following best explains why Tailwind CSS supports arbitrary values like
bg-[#123abc] or p-[10px]?Attempts:
2 left
💡 Hint
Think about why sometimes you need a size or color that Tailwind doesn't have by default.
✗ Incorrect
Arbitrary values let you write exact CSS values inside Tailwind classes. This helps when the default scale doesn't have what you want, so you can still use Tailwind's utility system with custom values.
📝 Syntax
intermediate1:30remaining
Correct syntax for arbitrary values in Tailwind
Which Tailwind CSS class correctly applies a margin of exactly 7 pixels using arbitrary values?
Attempts:
2 left
💡 Hint
Arbitrary values use square brackets around the exact CSS value.
✗ Incorrect
Arbitrary values in Tailwind must be wrapped in square brackets with no spaces, like m-[7px]. Other forms are invalid syntax.
❓ rendering
advanced2:00remaining
Visual result of using an arbitrary color value
What background color will the following Tailwind class produce?
bg-[#ff4500]Attempts:
2 left
💡 Hint
The hex code
#ff4500 is a known bright orange-red color.✗ Incorrect
The class bg-[#ff4500] sets the background color exactly to the hex color #ff4500, which is a bright orange-red shade.
❓ selector
advanced1:30remaining
Using arbitrary values with pseudo-classes
Which Tailwind class correctly applies a 3rem padding only on hover using arbitrary values?
Attempts:
2 left
💡 Hint
Pseudo-classes come before the utility name in Tailwind.
✗ Incorrect
In Tailwind, pseudo-classes like hover: prefix the utility class. So hover:p-[3rem] applies 3rem padding on hover.
❓ accessibility
expert2:30remaining
Accessibility considerations when using arbitrary color values
When using arbitrary background colors like
bg-[#123456] in Tailwind, what should you always check to ensure good accessibility?Attempts:
2 left
💡 Hint
Good contrast helps people with vision difficulties read text easily.
✗ Incorrect
Using arbitrary colors can cause poor contrast with text. Always check contrast ratios to keep text readable and accessible for all users.