<div class="father">
<div class="son"></div>
</div>
.father {
width: 200px;
height: 200px;
border: 1px solid #0a3b98;
position: relative;
background: skyblue;
}
.son {
width: 100px;
height: 100px;
position: absolute;
top: 0;
left: 0;
right: 0;
bottom: 0;
background: pink;
margin: auto;
}
This Pen doesn't use any external CSS resources.
This Pen doesn't use any external JavaScript resources.