0
0
Tailwindmarkup~20 mins

Utility-first approach vs traditional CSS in Tailwind - Practice Questions

Choose your learning style9 modes available
Challenge - 5 Problems
🎖️
Utility-First CSS Master
Get all challenges correct to earn this badge!
Test your skills under time pressure!
🧠 Conceptual
intermediate
2:00remaining
Understanding Utility-First CSS
Which statement best describes the utility-first CSS approach compared to traditional CSS?
AUtility-first CSS uses many small classes for styling directly in HTML, while traditional CSS uses separate style rules in CSS files.
BUtility-first CSS requires writing long CSS selectors, while traditional CSS uses short class names.
CUtility-first CSS avoids using classes and styles elements only with inline styles, unlike traditional CSS.
DUtility-first CSS only works with JavaScript frameworks, while traditional CSS works with plain HTML.
Attempts:
2 left
💡 Hint
Think about where the styles are applied in utility-first vs traditional CSS.
📝 Syntax
intermediate
1:30remaining
Tailwind Utility Class Syntax
Which Tailwind CSS class correctly applies a margin of 1rem on all sides?
Amargin-1rem
Bm-1rem
Cm-4
Dmargin-4
Attempts:
2 left
💡 Hint
Tailwind uses numeric scale for spacing classes, not direct CSS values.
rendering
advanced
2: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>
AA white button with blue text that becomes bold on hover and has square corners.
BA blue button with white bold text that darkens blue on hover and has rounded corners.
CA blue button with black text that changes to white background on hover and has sharp edges.
DA transparent button with blue border and no hover effect.
Attempts:
2 left
💡 Hint
Look at the background, text color, hover, font weight, padding, and border radius classes.
selector
advanced
2:00remaining
CSS Selector Specificity Comparison
Given traditional CSS selectors, which has the highest specificity?
Tailwind
/* CSS selectors */
.a {}
#id {}
div.a {}
.a.b {}
A#id
B.a.b
Cdiv.a
D.a
Attempts:
2 left
💡 Hint
ID selectors have higher specificity than class or element selectors.
accessibility
expert
3: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?
Aopacity-50 cursor-not-allowed focus:outline-none
Bopacity-100 cursor-pointer focus:ring-0
Copacity-25 cursor-default focus:ring-0
Dopacity-50 cursor-not-allowed focus:ring-2 focus:ring-blue-500
Attempts:
2 left
💡 Hint
Consider visual disabled look plus visible focus for keyboard users.