Opacity: 0, display: none, or visibility: hidden | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

Opacity: 0, display: none, or visibility: hidden

Hi, since I'm hiding elements a lot in most of my web projects, I need to ask. From what I know, there are 3 ways to hide an element: opacity: 0 hides it, but it still fills up the space, display: none hides it and doesn't fill up the space, but what does visibility: hidden do special?

1st Sep 2020, 12:06 PM
Qui-Gon Jinn
Qui-Gon Jinn - avatar
3 Answers
0
Visibility hides it but it still takes up the space it would when visible.
1st Sep 2020, 12:10 PM
Miracle Timothy
Miracle Timothy - avatar
0
Md. Nasif-ur-Rahman Rimon so there's no difference between opacity: 0 and visibility: hidden?
1st Sep 2020, 12:25 PM
Qui-Gon Jinn
Qui-Gon Jinn - avatar
0
Thanks, I get it now: Opacity: 0 responds to events, but visibility: hidden does not. Thanks so much!
1st Sep 2020, 12:32 PM
Qui-Gon Jinn
Qui-Gon Jinn - avatar