How to hide elements without having them take space on the page?

ripper234 picture ripper234 · May 28, 2010 · Viewed 293k times · Source

I'm using visibility:hidden to hide certain elements, but they still take up space on the page while hidden.

How can I make them totally disappear visually, as though they are not in the DOM at all (but without actually removing them from the DOM)?

Answer

Huusom picture Huusom · May 28, 2010

Try setting display:none to hide and set display:block to show.