How to center a page, example 3

In this example, I combined the two methods of example 1 and 2, which looks like this:

body{
	text-align:center;
}
#container{
	width:500px;
	margin-left:auto;
	margin-right:auto;
	text-align:left;
}

It doesn't really matter now with which browser1 you're viewing, the page is centered, and it stays centered when you make your window wider or narrower.

Mission accomplished :-) but....

This way, pages which are viewed in a window narrower than the total width of your page, will start disappearing off the left side of your screen in some browsers!

Therefore, next: how to prevent your page from slipping off your screen


1) all current browsers, not NN 4 or IE 3. IE 4 acts like IE 5 in this case.