We would like to know how to center a H1 tag inside a DIV.
<!DOCTYPE html>
<html>
<head>
<style type='text/css'>
#AlertDiv {<!-- ww w .j av a 2s . co m-->
top: 50%;
left: 50%;
width: 62px;
height: 50px;
color: white;
position: absolute;
text-align: center;
background-color: black;
margin: -25px 0 0 -31px;
}
#AlertDiv h1 {
margin: auto;
line-height: 50px;
vertical-align: middle;
}
</style>
</head>
<body>
<div id="AlertDiv">
<h1>Yes</h1>
</div>
</body>
</html>
The code above is rendered as follows: