I have a wrapper surrounding a header with content inside as well as a container with content inside. The wrapper is really on there to keep everything positioned to each other accordingly within the confines I set, as well as to center everything. I have my container to automatically re-size according to the content that goes inside of it, this works without issue. However, the wrapper around the header and the container won’t follow the same rule and ends up taking a height of 1px it seems. Please note: the code below will show the wrapper outlined by a dashed white border up at the top, it should instead wrap around everything it contains.
Here’s the code to the website on jsFiddle.
Any help would be greatly appreciated. I feel as though I closed all of my floats, I don’t see why the height: auto; on wrapper won’t work, but maybe there’s something I’m missing.
height: autoon#wrapperisn’t working because virtually every element inside it hasposition: absolute.What does
position: absolutedo? http://www.w3.org/TR/CSS21/visuren.html#absolute-positioningThe choices to fix your problem:
#wrapperan explicitheight– but that won’t work if you don’t know theheightbeforehand.heightof#wrapper.position: absoluteis not how you should position every element on the page. You should usefloats instead.For a comparison of using
position: absolutevsfloats, see:http://www.htmldog.com/guides/cssadvanced/layout/