How to place the div in the center of the web page

How to place the div in the center of the page

How to place the div in the center of the empty page. If you design any login form, SignUp form or any message going to show in the middle of the web page. In that you can use the margin value or any css property to place the div in the center of the page. In that you will assign any value, margin are top, bottom, left, right value if you see the div content on the different screen like tablet are mobile alignment will be misplaced. And it will irritate to the user’s how to solve this issue. He I will give the simple solution to solve the above all problem. Html and CSS code available below.

Here the HTML Part:
<html>
..
..
<body>
<div class=”logo”>
..
..
</div>
</body>
</html>

Here the Css Part:
body{
margin:0;
padding:0;
background-color:#1565C0;
}
.logo{
width:40%;
height:200px;
margin:auto auto;
position: absolute;
left:0;
right:0;
bottom:0;
top:0;
}
How to place the div in the center of the page
Copyright Labw3