Tailwind CSS
/Beginner
Visibility
Definition
Utilities for controlling the visibility of an element without altering the document layout.
Explain Like I'm New
Harry Potter's Invisibility Cloak. If you use `hidden` (display: none), the element disappears and everything shifts up to take its space. If you use `invisible`, the element disappears, but leaves a massive blank hole where it used to be. It still takes up space.
Real World Example
Hiding an error icon next to an input field until there is an error, preventing the input field from jumping around the screen when the icon appears.
Common Use Cases
- •Maintaining layout stability
- •Animations
Interactive Example
Interview Questions
basic
- What is the difference between `hidden` and `invisible`?
intermediate
- Can you click on a button that has the `invisible` class?