0
0
Tailwindmarkup~20 mins

Arbitrary color values in Tailwind - Practice Problems & Coding Challenges

Choose your learning style9 modes available
Challenge - 5 Problems
🎖️
Arbitrary Color Master
Get all challenges correct to earn this badge!
Test your skills under time pressure!
📝 Syntax
intermediate
2:00remaining
Using arbitrary color values in Tailwind CSS
Which of the following Tailwind CSS classes correctly applies a background color of #1a2b3c using an arbitrary color value?
Abg-[#1a2b3c]
Bbg-#1a2b3c
Cbg-[#1a2b3c]]
Dbg-\#1a2b3c
Attempts:
2 left
💡 Hint
Remember that arbitrary values in Tailwind must be wrapped in square brackets without extra characters.
rendering
intermediate
2:00remaining
Visual result of arbitrary color value
What background color will the following Tailwind CSS class apply?
bg-[rgb(255,0,0)]
ABright green background
BNo background color applied
CBright blue background
DBright red background
Attempts:
2 left
💡 Hint
The rgb() function uses red, green, blue values in order.
selector
advanced
2:00remaining
Selecting text color with opacity using arbitrary values
Which Tailwind CSS class correctly sets the text color to blue with 50% opacity using an arbitrary color value?
Atext-[rgba(0,0,255,0.5)]
Btext-[rgb(0,0,255,0.5)]
Ctext-[#0000ff80]
Dtext-opacity-50 text-blue-500
Attempts:
2 left
💡 Hint
RGBA color format includes red, green, blue, and alpha (opacity).
layout
advanced
2:00remaining
Combining arbitrary colors with layout utilities
You want a container with a background color of #ffcc00 and padding of 1rem using Tailwind CSS. Which class combination is correct?
Abg-[#ffcc00] padding-1rem
Bbg-[#ffcc00] p-4
Cbg-[#ffcc00] padding-4
Dbg-#ffcc00 p-1
Attempts:
2 left
💡 Hint
Padding 1rem corresponds to Tailwind's p-4 by default (1rem = 16px, p-4 = 1rem).
accessibility
expert
3:00remaining
Ensuring accessible contrast with arbitrary background colors
You apply an arbitrary background color bg-[#123456] to a button. Which text color class ensures the best accessibility by providing sufficient contrast?
Atext-black
Btext-[#123456]
Ctext-white
Dtext-gray-500
Attempts:
2 left
💡 Hint
Dark backgrounds usually need light text for good contrast.