[ACCEPTED]-how reserve height while display is none-css

Accepted answer
Score: 31

Instead of putting display: none; on your div, put visibility: hidden;. It 1 will be invisible, but still take up space.

Score: 4

Use visibility: hidden instead of display: none. Your element won't display, but 3 its dimensions still apply and affect other 2 elements because it's still a part of the 1 page flow.

Score: 3

if you can use visiblity hidden property 4 instead of display:none you can achieve 3 what you want.

When you do visibilty:hidden 2 it just make the elements opacity to 0 while 1 the element is still retaining its space.

Score: 0

Or if you are playing with jQuery fadeIn/fadeOut 3 and need that spot to remain empty but with 2 reserved height, then just wrap around needed 1 element with fixed height, for example:

<div style="height: 52px;">
     <img id="loader" src="loader.gif />
</div>

More Related questions