Profile image for Elie Andraos elieandraos
Centering A Fixed Sized DIV With CSS
Language
CSS
Tags
CSS

Centering A Fixed Sized DIV With CSS

1 div { 2 position: absolute; 3 top: 50%; 4 left: 50%; 5 width: 400px; 6 height: 300px; 7 margin-top: -150px; /* 1/2 of your element height*/ 8 margin-left: -200px; /* 1/2 of your element width */ 9 }

Comments