<!DOCTYPE html>
<html>
<head>
<title>Title of the document</title>
<style>
#blue {
position: relative;
}
#green {
position: absolute;
top: 50%;
height: 100px;
margin-top: -50px;
}
#blue {
border: 2px solid #1C87C9;
height: 10em;
}
#green {
border: 1px solid #8EBF42;
width: 100%;
}
</style>
</head>
<body>
<h1>Vertically aligned element</h1>
<div id="blue">
<div id="green"></div>
</div>
</body>
</html>