I was reading about difference between two css properties display:none
and visibility:hidden
and encountered DOM reflow term.
The statement was
display: none
causes DOM reflow where isvisibility: hidden
doesn't.
So my question is:
I was reading about difference between two css properties display:none
and visibility:hidden
and encountered DOM reflow term.
The statement was
display: none
causes DOM reflow where isvisibility: hidden
doesn't.
So my question is:
It means, that if you will set dinamically
display: none;
, your browser will recalculate positions of DOM elements, if visisbility: hidden; - not. Think, it becausevisibility: hidden;
does not change element sizes in dom.https://developers.google.com/speed/articles/reflow
display:none
hide thediv
as if thediv
is not rendered whereasvisibility:hidden
only hides but the space is still occupiedFor more information, please refer here: Repaints and Reflows: Manipulating the DOM responsibly