Responsive video embed for YouTube & Vimeo

Posted 2 years ago

.responsive-video {
   position: relative;
   padding-top: 60px; overflow: hidden;
   padding-bottom: 56.25%;
}

.responsive-video iframe,
.responsive-video object,
.responsive-video embed {
   width: 100%;
   height: 100%;
   position: absolute;
   top: 0;
   left: 0;
}

Then wrap your embed in

<div class="responsive-video">...</div>

Note: if you’re having trouble with the height of your video, adjust padding-bottom