Horizontally centre a website

Posted on by easywebuk

Web Design Hull

We use a fixed width when creating websites although this is not the only way to create a website we find that it allows us to keep complete control over the layout. When using a fixed width we find the best way to centre a website is to put it inside of a container and then apply styles using CSS.

To make sure the site is as accessible as possible we use a width of around 1000px so that it can easily be viewed on almost any monitor available today. The HTML and CSS mark up to centre a website is:

HTML

<div class="container">
<!-- Content Here -->
</div>

CSS

.container {
	width: 1000px;
	margin: 0 auto;
	text-align: center;
}

It’s as simple as that!

This entry was posted in Tutorials. Bookmark the permalink.

Leave a Reply

Your email address will not be published. Required fields are marked *

*


*

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>

^ Back to Top

Your Details:

Telephone Email

Website Information:



What services you need us to provide.
Domain Name Hosting Media
Ecommerce CMS SEO
Maintenance Web Video

Leave blank if we don't need to accommodate a budget.
£


Close it