<div class="container">
  <div class="item">Centered Item</div>
</div>
.container {
  display: flex;
  justify-content: center;
  align-items: center;
  height: 100vh;
  background: #f0f0f0;
}

.item {
  padding: 20px;
  background: #007bff;
  color: #fff;
  border-radius: 5px;
}

External CSS

This Pen doesn't use any external CSS resources.

External JavaScript

This Pen doesn't use any external JavaScript resources.