Skip to content

Instantly share code, notes, and snippets.

@DriginCode
Created February 8, 2017 20:55
Show Gist options
  • Save DriginCode/5ee83b1371f5250a9bf47297c4b99545 to your computer and use it in GitHub Desktop.
Save DriginCode/5ee83b1371f5250a9bf47297c4b99545 to your computer and use it in GitHub Desktop.
adaptive_video
<div class="relation">
<div class="relation__offset relation__offset-16-9"></div>
<div class="relation__content">
<iframe class="video__content" src="https://www.youtube.com/embed/KFVoIzaGPYg" ></iframe>
</div>
</div>
.relation{
max-width: 560px;
position: relative;
}
.relation__offset{
height: 0;
}
.relation__offset-1-1{
padding-top: 100%;
}
.relation__offset-16-9{
padding-top: 56.25%;
}
.relation__content{
position: absolute;
width: 100%;
height: 100%;
top: 0;
left: 0;
}
.relation__content iframe,
.relation__content object,
.relation__content embed
{
width: 100%;
height: 100%;
border: none;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment