In this tutorial we show you how to absolutely centering DIV vertically and horizontally
first of all you should put this CSS code in your page:
<style> html, body {height: 100%;} #CenteredDiv { width:300px; height:150px; position:absolute;l eft:50%; top:50%; margin:-75px 0 0 -150px; border:1px solid #222222; text-align:center; background-color:yellow; } </style>
after that just call this css with defining class in your html code:
<div id="CenteredDiv"></div>
That’s It
click here to see example below
Leave a Reply