Wrapper Width

Anything questions related to styling should go in here.
Post Reply
User avatar
EcazS
Posts: 789
Joined: Fri May 06, 2011 5:29 pm

Wrapper Width

Post 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.

:?
Torniquet
Posts: 52
Joined: Sun Jun 19, 2011 8:10 am
Contact:

Re: Wrapper Width

Post 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.
User avatar
EcazS
Posts: 789
Joined: Fri May 06, 2011 5:29 pm

Re: Wrapper Width

Post 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>
Post Reply