<div class="parent">
     <div class="child"></div>
</div>
.parent {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 100vh;
  width: 100wh;
}

.child {
  width: 100px;
  height: 100px;
  background-color: #000;
}
Run Pen

External CSS

This Pen doesn't use any external CSS resources.

External JavaScript

This Pen doesn't use any external JavaScript resources.