Current time: 09-09-2010, 06:25 PM Hello There, Guest! (LoginRegister)


Post Reply 
 
Thread Rating:
  • 0 Votes - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
How to: Center your website using CSS
03-08-2010, 10:41 PM
Post: #1
How to: Center your website using CSS
To center your web site using just CSS code, I would recommend creating a containing div. I'll show you how..

Before your content, add the following tag

Code:
<div id="container">

Then, at the end of your content add the following tag

Code:
</div>

Then, within the <head> tags of your page, add the following

Code:
<style type="text/css">
#container {width:XXXpx; height:auto; margin:0 auto;}
</style>

Set your width by replacing the xxx's above and your site should be centred!

Andrew
Hosted Web UK Staff
www.hostedweb.co.uk
Visit this user's website Find all posts by this user
Quote this message in a reply
Post Reply 


Forum Jump: