<!--  our html has a container which contains a div we wish to center-->
<div class="container center">
  <div class="inner">
body {
  height: 100%;

.container {
  background: black;
  width: 100%;
  height: 100%;
  font-size: 2rem;

.inner {
  background: turquoise;
  width: 50px;
  height: 50px;
  border-radius: 50%;

/* This is the main CSS that centers the div */
  display: grid;
  place-items: center;

External CSS

This Pen doesn't use any external CSS resources.

External JavaScript

This Pen doesn't use any external JavaScript resources.