- 1

What is the use of hiding an element using display: none property?

I mean, what are we going to do with an element that is invisible and doesn't occupy any space? In which context this display property will be useful?

10th Sep 2017, 6:55 AM
Jayachandran P
Jayachandran P - avatar
2 Respuestas
+ 7
Yes it seems pretty useless if you view it from the CSS perspective ONLY. But with Javascript, you can toggle the visibility based on certain criteria with your own logic. For example, you can show the POST button while hiding EDIT and DELETE button for creating new post and toggle it for existing post. 👌
10th Sep 2017, 7:05 AM
Zephyr Koo
Zephyr Koo - avatar
+ 6
Its useful in many ways , like I used here :- https://code.sololearn.com/WLVTZ0kY1t0f/?ref=app
10th Sep 2017, 7:35 AM
RZK 022
RZK 022 - avatar