View Full Version : How to make pages not span whole window

11-14-2007, 01:57 AM
Just trying to figure out how to make pages not span the whole window. I dont know where to change the setting. Thanks.


11-15-2007, 07:24 PM
Anyone have an idea? Its probably a lot more complicated than I think it is, but hopefully someone can give me an idea. Thanks!

11-16-2007, 12:59 AM
One way is to place the page in a fixed-width, centered div.

You'd add the "wrapper" div to your html like this:

<div id="wrapper">

... all your original page code ...

</div><!-- end of wrapper div -->

In your style sheet you would add this:

body {
text-align: center; /* to center the page in IE5 (and 6 in quirks mode) */

#wrapper {
text-align: left; /* to keep the center styling on the body from affecting anything else */
width: 750px; /* or whatever width you want your page to be */
margin-left: auto; /* the side margins will grow and shrink with the window size to keep the page centered in IE6+ and other browsers */
margin-right: auto;

11-16-2007, 01:07 AM
If you have any absolutely positioned elements on your page(s), then the layout will probably fall apart. In that case it may help to use relative positioning on #wrapper, so you would end up with the following styling for #wrapper.

#wrapper {
text-align: left;
width: 750px;
margin-left: auto;
margin-right: auto;
position: relative;