Display: none Vs Visibility: hidden

Coding is all about practical knowledge, so let’s understand difference between display: none; and visibility: hidden; property practically 😍😍.

👀My GitHub
👀My Insta

step:1 Let’s make three circle with different color i.e. Red, Green, and Blu…


This content originally appeared on DEV Community and was authored by Deepak Yadav

Coding is all about practical knowledge, so let's understand difference between display: none; and visibility: hidden; property practically 😍😍.

👀My GitHub
👀My Insta

step:1 Let's make three circle with different color i.e. Red, Green, and Blue.

Main img

Step:2

Now apply display: none; property to Green color circle

#green{
    display: none;
}

display: none; img

display: none; means that the tag will not appear on the page at all (although you can still interact with it through the Dom). There will be no space allocated for it between the other tags.

Step:3

Now apply visibility: hidden; property to green color circle

#green{
    visibility: hidden;
}

visibility: hidden; img

visibility: hidden means that unlike display: none, the tag is not visible, but space is allocated for it on the page. The tag is rendered, it just isn't seen on the page.

Hopefully you find this useful.
Share your thoughts in comment section 👇.


This content originally appeared on DEV Community and was authored by Deepak Yadav


Print Share Comment Cite Upload Translate Updates
APA

Deepak Yadav | Sciencx (2022-04-07T10:03:05+00:00) Display: none Vs Visibility: hidden. Retrieved from https://www.scien.cx/2022/04/07/display-none-vs-visibility-hidden/

MLA
" » Display: none Vs Visibility: hidden." Deepak Yadav | Sciencx - Thursday April 7, 2022, https://www.scien.cx/2022/04/07/display-none-vs-visibility-hidden/
HARVARD
Deepak Yadav | Sciencx Thursday April 7, 2022 » Display: none Vs Visibility: hidden., viewed ,<https://www.scien.cx/2022/04/07/display-none-vs-visibility-hidden/>
VANCOUVER
Deepak Yadav | Sciencx - » Display: none Vs Visibility: hidden. [Internet]. [Accessed ]. Available from: https://www.scien.cx/2022/04/07/display-none-vs-visibility-hidden/
CHICAGO
" » Display: none Vs Visibility: hidden." Deepak Yadav | Sciencx - Accessed . https://www.scien.cx/2022/04/07/display-none-vs-visibility-hidden/
IEEE
" » Display: none Vs Visibility: hidden." Deepak Yadav | Sciencx [Online]. Available: https://www.scien.cx/2022/04/07/display-none-vs-visibility-hidden/. [Accessed: ]
rf:citation
» Display: none Vs Visibility: hidden | Deepak Yadav | Sciencx | https://www.scien.cx/2022/04/07/display-none-vs-visibility-hidden/ |

Please log in to upload a file.




There are no updates yet.
Click the Upload button above to add an update.

You must be logged in to translate posts. Please log in or register.