/ Published in: CSS
Expand |
Embed | Plain Text
#wrapper { position:relative; } #centeredBox { position:absolute; top: 50%; left: 50%; width:200px; height:300px; margin-left: -100px; /*1/2 width*/ margin-top: -150px; /*1/2 of height*/ }
Comments
Subscribe to comments
You need to login to post a comment.

why not
centeredBox {width:200px;height:300px;margin:auto;}
?
because
margin:autoworks only for horizontal positioning