Skip to content

Instantly share code, notes, and snippets.

@vikrantnegi
Last active January 13, 2016 07:40
Show Gist options
  • Save vikrantnegi/e6c7a44a1aa6313a978e to your computer and use it in GitHub Desktop.
Save vikrantnegi/e6c7a44a1aa6313a978e to your computer and use it in GitHub Desktop.
Responsive embedded video
.video-wrapper {
position: relative;
padding-bottom: 56.25%;
}
.video-wrapper iframe {
position: absolute;
width: 100%;
height: 100%;
top: 0;
left: 0;
}
/*
To Calculate the padding %age do the following:
Given the video with an aspect ratio of 16:9
padding-bottom: ((9/16) * 100) %
*/
<div class="video-wrapper">
<iframe></iframe>
</div>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment