Home
» Other Stuff » CSS centering content on page
CSS centering content on page
| April 19, 2009 | Posted by The Futtock under 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;
}
Recent Comments