css align a div in center

by Prakash 2014-02-19 17:05:06

Write a class for aligning a div in the center position :

.center
{
margin-left:auto;
margin-right:auto;
width:70%;
background-color:#b0e0e6;
}


Use the above class as follows :


<div class="center">Hello World</div>



This div will align center with the parent div it contains

Tagged in:

547
like
0
dislike
0
mail
flag

You must LOGIN to add comments