Using CSS to centre page content

This example centres all the page content by wrapping it in a div element with an id of container. The div is then given a fixed width and auto margins:

  width: 40em;
  margin-left: auto;
  margin-right: auto;
  font-size: 80%;
  font-family: 'Lucida Grande', Verdana, Arial, Sans-Serif;
  background-color: #ffeecc;
  border: 1px solid #eeddbb;
  padding: 1em;

Return to the "Using CSS To Centre Content" article