Home › Forums › CSS › [Solved] Is display none the right way to hide an element? › Reply To: [Solved] Is display none the right way to hide an element?
November 18, 2014 at 12:35 pm
#188626
Participant
display: none
means it will be hidden AND removed from the flow of the website.
visibility: hidden
means it will be hidden, BUT will remain in the flow of the website.
Essentially, visibility: hidden
will not show the element, but will retain the space it takes up. Whereas display: none
completely removes it.
But, when you’re talking about doing what you’re doing, it’s actually best to remove it in the code. You’re still processing and rendering the code, but you’re just hiding it in the styles which means you’re losing that performance (no matter how small that is, it still counts).