alfie bowen
alfie bowen

Reputation: 33

How do I keep a bottom div a constant height below a top div with a div between them?

I have three divs aligned vertically and want the middle div to fade in and out with javascript by 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 independent of whether the middle div is displayed or not?

Upvotes: 3

Views: 43

Answers (1)

S-F
S-F

Reputation: 80

You'll want to use visibility: hidden; instead of display: none;

visibility: hidden; hides an element, but it will still take up the same space as before.

Upvotes: 1

Related Questions