Jump into concepts and practice - no test required
or
Recommended
Test this pattern10 questions across easy, medium, and hard to know if this pattern is strong
Recall & Review
beginner
What does the Tailwind CSS class hidden do?
The <code>hidden</code> class completely hides an element by setting <code>display: none;</code>. The element is removed from the page layout and is not visible or accessible.
Click to reveal answer
beginner
How does the Tailwind class invisible differ from hidden?
The <code>invisible</code> class makes an element invisible but it still takes up space in the layout. It sets <code>visibility: hidden;</code>, so the element is hidden but the space it occupies remains.
Click to reveal answer
intermediate
Which Tailwind class would you use to hide an element only on small screens but show it on medium and larger screens?
You can use hidden sm:block. This hides the element on small screens (<640px) and shows it as a block on screens medium and larger (≥640px).
Click to reveal answer
intermediate
What is the effect of using opacity-0 in Tailwind CSS?
The <code>opacity-0</code> class makes the element fully transparent but it remains visible to screen readers and still occupies space. It sets <code>opacity: 0;</code>.
Click to reveal answer
advanced
Why is it important to use semantic visibility classes like hidden or invisible instead of just setting display: none; in CSS directly?
Using Tailwind classes keeps your code consistent and easier to maintain. It also helps with responsive design by combining visibility control with breakpoints. Plus, Tailwind classes are optimized and easy to read.
Click to reveal answer
What does the Tailwind class hidden do?
AHides the element but keeps its space
BMakes the element transparent but still clickable
CRemoves the element from the layout and hides it
DChanges the element's color to transparent
✗ Incorrect
hidden sets display: none;, removing the element from layout and hiding it.
Which class hides an element but keeps its space reserved?
Ainvisible
Bhidden
Copacity-0
Dblock
✗ Incorrect
invisible sets visibility: hidden;, hiding the element but keeping its space.
How do you hide an element on small screens but show it on medium and larger screens in Tailwind?
Ahidden md:block
Bopacity-0 sm:block
Cinvisible lg:block
Dhidden sm:block
✗ Incorrect
hidden sm:block hides on small screens and shows on medium (sm) and larger.
What does opacity-0 do in Tailwind CSS?
AMakes the element fully transparent but still present
BHides the element and removes it from layout
CMakes the element invisible but clickable
DRemoves the element from the DOM
✗ Incorrect
opacity-0 sets opacity to zero, making the element transparent but still occupying space.
Why use Tailwind's visibility classes instead of custom CSS?
ATailwind classes are harder to read
BTailwind classes help with responsive design and consistency
CCustom CSS is always better
DTailwind classes do not support responsive design
✗ Incorrect
Tailwind classes make code consistent, easier to maintain, and support responsive visibility control.
Explain the difference between the Tailwind classes hidden and invisible.
Think about whether the element still takes up space on the page.
You got /4 concepts.
How can you use Tailwind classes to control element visibility responsively?
Consider how Tailwind handles responsive design with prefixes.
You got /4 concepts.
Practice
(1/5)
1. What does the Tailwind CSS class hidden do to an element?
easy
A. It changes the element's color to transparent.
B. It hides the element and removes its space from the layout.
C. It makes the element semi-transparent.
D. It hides the element but keeps its space in the layout.
Solution
Step 1: Understand the hidden class effect
The hidden class in Tailwind CSS sets display: none;, which hides the element completely.
Step 2: Effect on layout space
Because the element is removed from the layout flow, its space is also removed, so no empty gap remains.
Final Answer:
It hides the element and removes its space from the layout. -> Option B
Quick Check:
hidden = hides + removes space [OK]
Hint: Hidden removes element and space; invisible hides but keeps space [OK]
Common Mistakes:
Thinking hidden keeps space like invisible
Confusing hidden with opacity or visibility
Assuming hidden only makes element transparent
2. Which Tailwind CSS class hides an element but keeps its space reserved in the layout?
easy
A. hidden
B. opacity-0
C. sr-only
D. invisible
Solution
Step 1: Identify the class that hides but keeps space
The invisible class sets visibility: hidden;, which hides the element but keeps its space.
Step 2: Compare with other options
hidden removes element and space, opacity-0 makes element transparent but still interactive, sr-only hides visually but accessible to screen readers.
Final Answer:
invisible -> Option D
Quick Check:
invisible = hide but keep space [OK]
Hint: Invisible hides but reserves space; hidden removes space [OK]
Common Mistakes:
Choosing hidden instead of invisible
Confusing opacity-0 with invisible
Thinking sr-only hides visually and removes space
3. What will be the visible result of this HTML snippet with Tailwind classes?
Hint: Use sr-only to hide visually but keep screen reader access [OK]
Common Mistakes:
Using hidden which removes from accessibility tree
Using invisible which hides visually but not accessible
Using opacity-0 which hides visually but still interactive
5. You have a navigation menu that should be hidden on mobile but visible on larger screens. Which Tailwind classes correctly hide the menu on small screens but show it on medium and above?
hard
A. block md:hidden
B. invisible md:hidden
C. hidden md:block
D. hidden md:hidden
Solution
Step 1: Understand responsive classes
hidden hides element by default (mobile), md:block shows element as block on medium screens and larger.
Step 2: Check other options
invisible md:hidden hides but keeps space on mobile and hides on medium, so menu never visible. block md:hidden shows on mobile but hides on medium, opposite of requirement. hidden md:hidden hides always.
Final Answer:
hidden md:block -> Option C
Quick Check:
Hide mobile, show medium+ = hidden md:block [OK]
Hint: Use hidden for mobile, md:block to show on medium screens [OK]
Common Mistakes:
Using md:hidden hides on medium screens instead of showing
Using invisible which keeps space and confuses layout