display: none
This method doesn’t allow transition effects.
opacity
+ pointer-events
+ visibility
Instead of display: none
, a combination of the three mentioned CSS properties can be used.
opacity
: Hide element visually.pointer-events
: Make it inaccessible to mouse and keyboard.visibility
: Hide it from screen readers.
To show the element again: