CSS centering content on page
Posted 19 April, 2009 in Other Stuff
Centering your content on a page using CSS is not complicated once you know how:
- You need to create a content or container div that all the content goes into.
- In your css you need to give the content container a width and then set the left and right margins to auto.
Example HTML:
<body>
<div id=”content”>
<!– Content goes here –>
</div>
</body>
Example CSS:
#content {
margin-left: auto;
margin-right: auto;
width: 500px;
}




