<div class="container">
  <div class="child"></div>
</div>
.container {
  width: 250px;
  height: 150px;
  margin: 0 auto;
  border: 5px solid gray;
  background-color: lightblue;
}
.child {
  width: 40%;
  height: 100%;
  margin: 0 auto;
  background-color: lightcoral;
}

External CSS

This Pen doesn't use any external CSS resources.

External JavaScript

This Pen doesn't use any external JavaScript resources.