0
0
Tailwindmarkup~20 mins

Responsive utility overrides in Tailwind - Practice Problems & Coding Challenges

Choose your learning style9 modes available
Challenge - 5 Problems
🎖️
Responsive Utility Master
Get all challenges correct to earn this badge!
Test your skills under time pressure!
selector
intermediate
2:00remaining
Which Tailwind class will make text red on small screens but blue on medium screens?
You want the text color to be red on small screens and blue on medium screens and larger. Which class combination achieves this?
Amd:text-red-500 text-blue-500
Btext-red-500 md:text-blue-500
Ctext-red-500 text-blue-500 md:text-blue-500
Dtext-blue-500 md:text-red-500
Attempts:
2 left
💡 Hint
Remember that Tailwind applies mobile-first styles, so unprefixed classes apply to all screen sizes unless overridden.
layout
intermediate
2:00remaining
How to make a div full width on mobile but half width on large screens using Tailwind?
You want a <div> to take full width on small screens and half the width on large screens. Which class set achieves this?
Aw-full w-1/2 lg:w-1/2
Bw-1/2 lg:w-full
Cw-full lg:w-1/2
Dlg:w-full w-1/2
Attempts:
2 left
💡 Hint
Think about mobile-first approach and how prefixes override base styles.
🧠 Conceptual
advanced
2:00remaining
What happens if you use conflicting Tailwind classes without responsive prefixes?
Consider the classes text-green-500 and text-red-500 applied together on the same element without any prefixes. What will be the text color?
AThe text will be red because the last class overrides the first.
BThe text will be a mix of green and red.
CThe browser will throw an error due to conflicting classes.
DThe text will be green because it appears first.
Attempts:
2 left
💡 Hint
CSS applies styles in order, with later rules overriding earlier ones if they have the same specificity.
accessibility
advanced
2:00remaining
How to ensure responsive text size changes remain accessible in Tailwind?
You want text to be small on mobile and larger on desktop using Tailwind. Which approach best supports accessibility?
AUse relative sizes like <code>text-base md:text-xl</code> and test with browser zoom and screen readers.
BUse only one text size for all screens to avoid confusion.
CUse fixed pixel sizes like <code>text-sm md:text-lg</code> without considering user preferences.
DUse <code>!important</code> in custom CSS to force sizes regardless of user settings.
Attempts:
2 left
💡 Hint
Accessibility means respecting user settings and making text readable on all devices.
📝 Syntax
expert
2:00remaining
What error occurs if you write this Tailwind class incorrectly: md:text-lg text-base md:text-sm?
Given the classes md:text-lg text-base md:text-sm on an element, what will be the effective text size on medium screens and why?
AThis will cause a syntax error in Tailwind and no styles will apply.
BText size will be large because the first md: class applies and later ones are ignored.
CText size will be base because unprefixed classes override prefixed ones.
DText size will be small because the last md: class overrides the previous md: class.
Attempts:
2 left
💡 Hint
Later classes override earlier ones if they set the same CSS property and have the same specificity.