Challenge - 5 Problems
Utility-First CSS Master
Get all challenges correct to earn this badge!
Test your skills under time pressure!
🧠 Conceptual
intermediate2:00remaining
Understanding Utility-First CSS
Which statement best describes the utility-first CSS approach compared to traditional CSS?
Attempts:
2 left
💡 Hint
Think about where the styles are applied in utility-first vs traditional CSS.
✗ Incorrect
Utility-first CSS applies many small, reusable classes directly in HTML elements to style them. Traditional CSS writes style rules separately in CSS files targeting selectors.
📝 Syntax
intermediate1:30remaining
Tailwind Utility Class Syntax
Which Tailwind CSS class correctly applies a margin of 1rem on all sides?
Attempts:
2 left
💡 Hint
Tailwind uses numeric scale for spacing classes, not direct CSS values.
✗ Incorrect
In Tailwind, m-4 applies margin using the spacing scale, where 4 equals 1rem by default.
❓ rendering
advanced2:30remaining
Visual Result of Utility Classes
What will be the visual effect of this HTML snippet using Tailwind CSS?
<button class="bg-blue-500 hover:bg-blue-700 text-white font-bold py-2 px-4 rounded">Click Me</button>
Attempts:
2 left
💡 Hint
Look at the background, text color, hover, font weight, padding, and border radius classes.
✗ Incorrect
The classes set a blue background, white bold text, padding, rounded corners, and a darker blue background on hover.
❓ selector
advanced2:00remaining
CSS Selector Specificity Comparison
Given traditional CSS selectors, which has the highest specificity?
Tailwind
/* CSS selectors */
.a {}
#id {}
div.a {}
.a.b {}Attempts:
2 left
💡 Hint
ID selectors have higher specificity than class or element selectors.
✗ Incorrect
ID selectors (#id) have higher specificity than class selectors (.a, .b) or element selectors (div).
❓ accessibility
expert3:00remaining
Accessibility in Utility-First CSS
Which Tailwind utility class combination best improves accessibility for a button that visually looks disabled but remains keyboard focusable?
Attempts:
2 left
💡 Hint
Consider visual disabled look plus visible focus for keyboard users.
✗ Incorrect
Using opacity-50 and cursor-not-allowed visually indicates disabled. Adding focus:ring-2 focus:ring-blue-500 ensures keyboard users see focus outline, improving accessibility.