0
0
Tailwindmarkup~20 mins

Responsive visibility toggling in Tailwind - Practice Problems & Coding Challenges

Choose your learning style9 modes available
Challenge - 5 Problems
🎖️
Responsive Visibility Master
Get all challenges correct to earn this badge!
Test your skills under time pressure!
selector
intermediate
2:00remaining
Which Tailwind class hides an element only on small screens?
You want an element to be visible on medium and larger screens but hidden on small screens. Which class achieves this?
Amd:hidden block
Bblock md:hidden
Chidden sm:block
Dhidden md:block
Attempts:
2 left
💡 Hint
Think about when the element should be hidden and when it should show.
layout
intermediate
2:00remaining
What is the visible layout of this code on a large screen?
Given this HTML snippet with Tailwind classes:
<div class="flex flex-col md:flex-row">
  <div class="block md:hidden">A</div>
  <div class="hidden md:block">B</div>
</div>

What will be visible on a large screen (≥ md)?
AOnly B is visible, arranged horizontally
BOnly A is visible, arranged vertically
CBoth A and B are visible, arranged vertically
DBoth A and B are visible, arranged horizontally
Attempts:
2 left
💡 Hint
Check which elements are hidden or shown at medium breakpoint and the flex direction.
rendering
advanced
2:00remaining
What is the visual output on a small screen?
Consider this HTML with Tailwind classes:
<button class="bg-blue-500 text-white p-4 hidden sm:inline-block">Click Me</button>

What will the user see on a small screen (less than 640px wide)?
AThe button is hidden and not visible
BThe button is visible with blue background and white text
CThe button is visible but without background color
DThe button is visible but with default inline style
Attempts:
2 left
💡 Hint
Look at the hidden and sm:inline-block classes and when they apply.
accessibility
advanced
2:00remaining
Which approach improves accessibility when toggling visibility responsively?
You want to hide content visually on small screens but keep it accessible to screen readers. Which Tailwind class combination is best?
AUse <code>hidden sm:block</code> to hide visually and show on larger screens
BUse <code>sr-only sm:not-sr-only</code> to hide visually but keep accessible on small screens
CUse <code>invisible sm:visible</code> to hide visually but keep layout space
DUse <code>opacity-0 sm:opacity-100</code> to hide visually but keep accessible
Attempts:
2 left
💡 Hint
Screen reader only classes help keep content accessible but hidden visually.
🧠 Conceptual
expert
3:00remaining
Why is using hidden md:block preferred over block md:hidden for responsive visibility?
Consider these two Tailwind class patterns:
1. hidden md:block
2. block md:hidden

Why is the first pattern generally better for responsive visibility toggling?
ABecause it uses fewer classes and is easier to maintain
BBecause it shows content by default and hides it on larger screens, which is better for SEO
CBecause it hides content by default and shows it on larger screens, improving load performance and accessibility
DBecause it applies visibility changes only on hover, improving user experience
Attempts:
2 left
💡 Hint
Think about default visibility and how hiding content early affects accessibility and performance.