Friday, 7 January 2011

Centering divs etc in CSS

Most objects in an html file can be centred using CSS simply by giving it a width and setting the margins to auto.

eg
.centered {
width: 80%;
margin-left:auto;
margin-right:auto;
}

No comments:

Post a Comment