<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: 50%;
  left: 50%;
  margin-left: -50px;
  margin-top: -50px;
  background: pink;
}
Run Pen

External CSS

This Pen doesn't use any external CSS resources.

External JavaScript

This Pen doesn't use any external JavaScript resources.