Hint: Always wrap color values in square brackets for arbitrary colors [OK]
Common Mistakes:
Omitting square brackets
Using parentheses instead of brackets
Using rgb instead of rgba for transparency
3. What color will the text be if you use this Tailwind class? text-[hsl(120,100%,50%)]
medium
A. Bright green
B. Bright red
C. Bright blue
D. Bright yellow
Solution
Step 1: Understand HSL color values
HSL stands for hue, saturation, and lightness. Hue 120° corresponds to green.
Step 2: Analyze saturation and lightness
100% saturation and 50% lightness means the color is bright and fully saturated green.
Final Answer:
Bright green -> Option A
Quick Check:
Hue 120° = green [OK]
Hint: Hue 120° in HSL means green color [OK]
Common Mistakes:
Confusing hue degrees with other colors
Ignoring saturation and lightness effects
Assuming default Tailwind colors instead of arbitrary
4. Identify the error in this Tailwind class: bg-[#12345G]
medium
A. Missing square brackets
B. Wrong prefix, should be 'background-'
C. Invalid hex color code due to 'G'
D. Hex code too short
Solution
Step 1: Check hex color validity
Hex colors only allow digits 0-9 and letters A-F (case-insensitive). 'G' is invalid.
Step 2: Confirm brackets and prefix
Square brackets and prefix bg- are correct here.
Final Answer:
Invalid hex color code due to 'G' -> Option C
Quick Check:
Hex digits must be 0-9 or A-F [OK]
Hint: Hex colors only use 0-9 and A-F letters [OK]
Common Mistakes:
Ignoring invalid hex characters
Thinking brackets are missing
Confusing prefix names
5. You want a button with a background color that changes based on light or dark mode using arbitrary colors. Which Tailwind class combination is correct?
hard
A. bg-[rgb(255,255,255)] dark:bg-[rgb(300,300,300)]
B. bg-[rgb(255,255,255)] bg-dark:[rgb(30,30,30)]
C. bg-[rgb(255,255,255)] dark:bg(rgb(30,30,30))
D. bg-[rgb(255,255,255)] dark:bg-[rgb(30,30,30)]
Solution
Step 1: Use correct dark mode prefix
Tailwind uses dark: prefix to apply styles in dark mode.
Step 2: Use correct arbitrary color syntax
Colors must be inside square brackets with valid CSS color values.
Step 3: Validate color values
RGB values must be between 0 and 255; bg-[rgb(255,255,255)] dark:bg-[rgb(300,300,300)] has invalid 300 values.
Final Answer:
bg-[rgb(255,255,255)] dark:bg-[rgb(30,30,30)] -> Option D