<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;
}
.child {
margin: auto;
}
This Pen doesn't use any external CSS resources.
This Pen doesn't use any external JavaScript resources.