Page 1 of 1

Wrapper Width

Posted: Wed Jun 29, 2011 7:21 pm
by EcazS
I just ran into a problem. Normally when I use wrappers I just set a fixed width and use margin: 0 auto to get it in the middle but this time I don't wanna set a fixed width but I still want it in the middle. I tried doing width: auto but that didn't work.

The reason I don't want it fixed is because sometimes the content will be of the page will be longer than others and I don't want to much white-space around the edges.

:?

Re: Wrapper Width

Posted: Wed Jun 29, 2011 7:56 pm
by Torniquet
if your not setting a fixed width then you have nothing to center as it will stretch across the entire width of the page.

if you want some white space around the edge, add a side margin.

Re: Wrapper Width

Posted: Wed Jun 29, 2011 9:59 pm
by EcazS
Solved
#hidden {overflow: hidden;position:relative;}
#wrapper {left: 50%;float: left;position: relative;}

.box {
    left: -50%;
    float:left;
    position: relative;
}
<div id="hidden">
     <div id="wrapper">
          <div class="box">
               Content bla bla bla bla bla
          </div>
     </div>
</div>