How do I keep the bottom div of a constant height below the top div with a div in between?

I have three divs aligned vertically and want the middle div to fade in and out using javascript, animating the opacity and setting "display: none;". However, when I do this, it causes the bottom div to move down the page to make room for the middle div.

How can I make the bottom div a constant height below the top div regardless of whether the middle div is visible or not?

+3


source to share


1 answer


You want to use visibility: hidden;

insteaddisplay: none;



visibility: hidden;

hides the element, but it will still occupy the same space as before.

+1


source







All Articles