www. Expression-Web-Tutorial .com

Call 1.866.363.5633

 

view cart

A Place For Beginners

Center a Div (ie.. center a Page)

A Popular CSS How-To

 A Div is an HTML tag:  <div> </div>  -- that generates a rectangular box on the page.

To center a div, we need to create a simple CSS Style Declaration and apply it to the div.

2 Properties applied to the div will center the div:

  •  width
  • "auto" margins on the left and right.
#container { width: 950px; margin: 0px auto; }

OR

#container {width: 96%; margin: 0px auto 0px auto;}

Watch the Video

Center a Div - Center a Web Page