Center a Div Tag in CSS

Centering something with CSS isn’t very easy. Here is the simple code to center a div in the middle of a page.

text-align: left;
margin-top: 0;
margin-right: auto;
margin-bottom: 0;
margin-left: auto;

Just add that to a CSS Div and it will center it.

Written by Andy Feliciotti

Andy Feliciotti is a Web Designer out of College Park, Maryland. He diggs web design and social media, if it's on the internet he has probably seen it. You can check out what Andy finds daily on his twitter.


One Response to “Center a Div Tag in CSS”

  1. This brings me to an idea:…

Leave a Comment