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.

Leave a Comment