Quick Tip: Centering A Website Using CSS
May 15th, 2011
No comments
It's very easy to centre your website using CSS. All you have to do is apply the following CSS to your website's outermost container, even if it is a table or div element. Also, remember that the container must have a defined width!
HTML
<div class="container">...website markup here...</div>
CSS
div.container {margin-left: auto; margin-right: auto; width: 1024px;}
Categories: Code Snippets, CSS, Quick Tip