.box
View Compiled
.box {
  background-color: gray;
  width: 50%;
  margin: 0 auto;
  height: auto;
  position: relative;
  &::before {
    content: '';
    display: block;
    padding-top: 50%;
  }
}
View Compiled

External CSS

This Pen doesn't use any external CSS resources.

External JavaScript

This Pen doesn't use any external JavaScript resources.