Shaun Wilson
Shaun Wilson

Reputation: 211

Hidden divs taking up space

I've set up all my navigation for my website as hide.show divs (using behaviours). It all works pretty well, but I've now realised the problem of the divs taking up space even when they're hidden, extending the height of my wrapper far too much.

I really want the height to extend and contract according to the amount of content on display.

http://shanuea.lockernerd.co.uk/camel/

The divs are absolutely positioned and set to visibility:hidden. Any help appreciated, please let me know if you need more info.

Upvotes: 21

Views: 37976

Answers (2)

Webdevotion
Webdevotion

Reputation: 1243

Just a reminder to future googlers:
I had some <span> tags which I wanted to hide from visitors. Behind each <span> was a <br>. The <br> tags made it look like the <span> tags were still taking up space after setting their display property to none.

Upvotes: 7

Stefan Haustein
Stefan Haustein

Reputation: 18793

Use display:none instead of visibility:hidden if you want the divs to take up no space when they are not displayed.

Upvotes: 44

Related Questions