How to make a DIV absolute center in Browser display area.
May 14, 2011 Leave a comment
Here is the Code . Copy this and paste it in the HTML editor and see the preview in browser
<div style="width:400px;height:200px;position:absolute;top:50%;left:50%;margin-left:-200px;margin-top:-100px;background:#e5e5e5;border:5px solid #999999;z-index:999;-moz-box-shadow:0 5px 5px #000000;-webkit-box-shadow:0 5px 5px #000000;-moz-border-radius:20px;-webkit-border-radius:20px;"> <h2 style="margin:20px;">This will be perfectly Center aligned. Now resize th browser window and see that the DIV will be dynamically centered.
</div>

