Use CSS to center content

http://www.elated.com/articles/css-center-content/

 

CSS centering: The basic technique

The trick to centering an element with CSS is to give the element a left and right margin value of auto :

#myElement
{
  width: 500px;
  margin-left: auto;
  margin-right: auto;
}
 

Center a page

To center all the content in a page horizontally within the browser window, first make sure the content is inside a container div element, and give the div a width. You can then apply auto margins to the div

#container
{
  width: 40em;
  margin-left: auto;
  margin-right: auto;
}
 

你可能感兴趣的:(content)