Centering webpage layout with CSS

emiii0

Limp Gawd
Joined
Aug 31, 2004
Messages
297
I can't figure this out for the life of me. Basically, I created three boxes and I created a box called surround, that surrounds the boxes so when I try to center it will all move together. The code is below.

div.surround {
width: 715px;
height: 730px;
position: absolute;
margin-left: 20%;
margin-right: 20%;
border: solid;
background: #ffffff;
}

I just want to have it so it is centered with equal amount of white space on each side of the box, and when I minimize the browser I want the sides to stay proportional to each other. Can someone enlighten me? Thank you!
 
Yep, GJSNeptune is right... though if div.surround is a direct child of the body element, you should probably set the body to text-align: center; This will eliminate any cross-browser quirks -- at least in my experience.
 
Back
Top