Skip to content

Instantly share code, notes, and snippets.

@onishiweb
Created October 23, 2014 08:40
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save onishiweb/fc8ecb349fc00c2768e8 to your computer and use it in GitHub Desktop.
Save onishiweb/fc8ecb349fc00c2768e8 to your computer and use it in GitHub Desktop.
A Pen by Adam Onishi.
<div class="video-wrapper">
<iframe src="//www.youtube.com/embed/bVKCHZqax84" frameborder="0" allowfullscreen></iframe>
</div>
.video-wrapper {
position:relative;
width:100%;
height:0;
padding-top:25px;
padding-bottom:100%; /* default */
}
@media screen and (min-aspect-ratio: 4/3) {
.video-wrapper{
padding-bottom:75%;
}
}
@media screen and (min-aspect-ratio: 16/9) {
.video-wrapper{
padding-bottom:56.25%; /* 16:9 */
}
}
.video-wrapper iframe {
position:absolute;
top:0;
left:0;
width:100%;
height:100%;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment