Horizontal-Vertical div align

#mydiv {
position:absolute;
top: 50%;
left: 50%;
width:350px;
height:300px;
margin-top: -150px; /*set to a negative number 1/2 of your height*/
margin-left: -175px; /*set to a negative number 1/2 of your width*/
border: 2px solid #2982C6;
background-color: #FFF;
text-align: center;
}

source

Leave a Reply