<div class="container">
  <div class="element"></div>
</div>
.container{
  position: relative;
}
.element{
  position: absolute;
  top: 50%; left: 50%;
  transform: translate(-50%, -50%);
}

.container{
  position:relative;
  width:90vw;
  height: 90vh;
  border: 3px solid steelblue;
  margin: auto;
}

.element{
  position:absolute;
  background: tomato;
  width: 50vw; height: 50vh;
}

/* just aesthetics */
body{
  height: 100vh;
  display:flex;
  background: azure;
}

External CSS

This Pen doesn't use any external CSS resources.

External JavaScript

This Pen doesn't use any external JavaScript resources.