Maybe one of the strangest things in HTML and CSS is the difficulty to get things centered.
Of course there's the
Code: (CSS)
#back {
width: 900px;
margin-left: -440px;
left: 50%;
}
(This also works vertically with margin-top and height.)
The advantages:
- page is centered
- works in IE 6, IE 7, FF 2, Opera 9.2
The disadvantages:
- width of the website has to be known in advance
- if the browser is smaller then the intended width both sides of the page will fall outside of the viewport