I have a div with style="display:none"
. After placing some content inside, i calculate its height using height()
method of JQuery. This is working fine and returning correct height.
But, I came across this post and came to know that, an element with style="display:none"
will have 0 height and width. So, ideally, I had to change 'display:none'
to 'visibility:hidden'
and use height()
method or use other alternatives to get correct height.
But, then, how my code work when calling height()
method of JQuery on a div style="display:none"
? Is this going to be a consistent behavior?
In other words, height() method does not differentiate between display:none and display:block. IS this a consistent behavior? offset height is 0 if display is none as expected.