Source Code: (back to article)
<!DOCTYPE html>
<html>
<head>
<title>Title of the document</title>
<style>
.parent {
position: relative;
text-align: center;
height: 300px;
background-color: lightblue;
}
.child {
position: absolute;
top: 0;
bottom: 0;
left: 0;
right: 0;
width: 50%;
height: 10%;
margin: auto;
font-size: 20px;
line-height: 28px;
padding: 10px;
background-color: pink;
}
</style>
</head>
<body>
<div class="parent">
<div class="child">Example</div>
</div>
</body>
</html>