<div class="parent">
  <div class="child"></div>
</div>
:root {
  --animation-speed: 2s;
  --primary-color: #fff;
  --secondary-color: #000;
  --background-color: #212121;
  --text-color: #fff;
  --font: sans-serif;
}

* {
  margin: 0;
  padding: 0;
}

body {
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  background: var(--background-color);
  font-family: var(--font);
}
.parent {
  background: var(--primary-color);
  width: 300px;
  height: 300px;
}

.child {
  background: limegreen;
  width: 150px;
  height: 150px;
}

/* Main Properties */

.parent {
  display: grid;
  justify-content: center; /* Horizontal */
  align-content: center; /* Vertical */
}

External CSS

This Pen doesn't use any external CSS resources.

External JavaScript

This Pen doesn't use any external JavaScript resources.