difference between “display: none” and “visibility: hidden”? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 9

difference between “display: none” and “visibility: hidden”?

19th Jun 2019, 11:46 AM
Dèépãk Gûptå
Dèépãk Gûptå - avatar
5 Answers
+ 15
• display: none - hides an element, so it does not take up any space. The element will be hidden, and the page will be displayed as if the element is not there. • visibility: hidden - hides an element, but it will still take up the same space as before. The element will be hidden, but it will still affect the layout.
19th Jun 2019, 2:57 PM
Anshu Kumari
Anshu Kumari - avatar
+ 5
https://code.sololearn.com/WAFkqeajs9bT/?ref=app 👆 There's an element with display:none between box 1 and box 2 and an invisible element between box 2 and box 3 An element with display:none isn't displayed at all. It takes up no space. Visibility:hidden means that the element is there (it takes up space), but it's invisible
19th Jun 2019, 12:04 PM
Anna
Anna - avatar
+ 1
For a div the former suppresses and the latter eliminates expression of the div 🤔
19th Jun 2019, 4:10 PM
Sanjay Kamath
Sanjay Kamath - avatar
+ 1
The visibility if it is hidden there will be spaces still to be left on the page but if it is display none the spaces vanishes .....
20th Jun 2019, 5:47 PM
Shelton Nkomo
Shelton Nkomo - avatar
0
Display: none; hace que el elemento seleccionado no se despliegue en la pagina. Visibility: hidden; hace que el elemento seleccionado se vuelva por así decirlo "invisible" pero sigue ocupando el mismo espacio 👍💻🙋😀
20th Jun 2019, 4:24 AM
Samuel Alejandro Gonzalez
Samuel Alejandro Gonzalez - avatar