<div class="aspectration" data-ratio="16:9">
  <iframe src="https://www.youtube.com/embed/upPCohrJcbw?showinfo=0&modestbranding=1" frameborder="0" allowfullscreen="" class="content"></iframe>
</div>
html,
body {
  height: 100vh;
  width: 100vw;
}
body {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 30vw;
  margin: 0 auto;
  animation: change 8s linear alternate infinite;
}
.aspectration {
  position: relative;
  width: 100%;
  
  &::after {
    content: "";
    display: block;
    width: 1px;
    margin-left: -1px;
    background-color: orange;
  }
  
  &[data-ratio="16:9"]::after {    
    padding-top: 56.25%;
  }
  
  .content {
    width: 100%;
    height: 100%;
    position: absolute;
    top: 0;
    left: 0;
  }
}

@keyframes change {
  0% {
    width: 30vw;
  }
  100% {
    width: 60vw;
  }
}


View Compiled

External CSS

This Pen doesn't use any external CSS resources.

External JavaScript

This Pen doesn't use any external JavaScript resources.