So if we have a div that is not visible though different situation, z-index
, opacity,
parent's overflow:hidden
and relatively/absolute positioning etc...
Is it necessary or just better to set display:none
to that div ? I could imagine browser will skip display:none
div while it will have to do some calculation otherwise for same result.
I'm asking this because I'm working on animations and setting display:none
require a callback when animation is completed meaning css3 transition should be avoid. (I know some browser offers a way to get callback from css3 transition but not enough 'universal' for me.)
Another way of saying it would be :
Is it faster to reflow/repaint div with display:none
rather than with width:0;height:0
, left:-100000px
... ?
UPDATE 2
I found out that, in chrome, if you have an svg inside a div with display:none
you can't reference it using <use xlink:href="">
. If you use anything else rather than display:none
like visibility:hidden
, width:0;height:0
... reference works.
This means using display:none
made the browser to skip some steps.
So I'll take that as a partial yes : using display:none
may slightly ease the rendering procedure.