How to Horizontally and Vertically Centre a div of browser using css



<!doctype html>
<html>
<head>
<meta charset="utf-8">
<title>Horizontally and Vertically Centre</title>
<style>
*{padding:0;margin:0;border:none;}
html,body{width:100%; height:100%;}
.center{width:50%;height:50%;background:#ccc; border:#333 solid 1px;margin:auto;position:absolute;top:0; left:0; bottom:0;right:0;color:#333; font-size:24px;}
</style>
</head>

<body>
<div class="center">
Horizontally and Vertically Centre
</div>
</body>
</html>



Share on Google Plus

About alpanadesign

This is a short description in the author block about the author. You edit it by entering text in the "Biographical Info" field in the user admin panel.
    Blogger Comment
    Facebook Comment

0 comments: