Have a new project in the pipeline?

Proposal Form

How to centre a DIV using CSS

3rd August, 2010

In our Tidy Blog we will show you how to use CSS to control the style and layout of multiple web pages! For example, if you wanted your content DIV to have a width of 700 pixels and to be centred in the browser your CSS would read:

#content {
  width: 700px;
  margin-left: auto;
  margin-right: auto;
}

The above  code works in IE 6, 7, 8, Firefox, Opera and Safari so all you now need to do is insert:

<div id=”content”>test</div>

in the body of your webpage and away you go!

Web Design Posts

Recent Posts