Skip to content

Instantly share code, notes, and snippets.

@tomkeays
Created February 16, 2018 22:26
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save tomkeays/aecf096ec133bd7cf2747e45b5190bde to your computer and use it in GitHub Desktop.
Save tomkeays/aecf096ec133bd7cf2747e45b5190bde to your computer and use it in GitHub Desktop.
Responsive YouTube Snippet
<style>
.videoWrapper {
position: relative;
padding-bottom: 56.25%; /* 16:9 */
padding-top: 25px;
height: 0;
}
.videoWrapper iframe {
position: absolute;
top: 0;
left: 0;
width: 100%;
height: 100%;
}
</style>
<div class="videoWrapper">
<iframe allow="autoplay; encrypted-media" allowfullscreen="" frameborder="0"
src="https://www.youtube.com/embed/xxxxxxxxxx?rel=0" height="315" width="560"></iframe>
</div>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment