Skip to content

Instantly share code, notes, and snippets.

@phette23
Last active December 15, 2015 15:08
Show Gist options
  • Save phette23/5278999 to your computer and use it in GitHub Desktop.
Save phette23/5278999 to your computer and use it in GitHub Desktop.
Markup for making a fluid-width YouTube video embed. Better to do it in markup than use FitVids, where the markup was taken from.
<!-- just replace {{id}} with the video's ID
e.g. 9bZkp7q19f0 -->
<div style="width:100%;position:relative;padding:0;padding-top:75%">
<iframe
style="position:absolute;top:0;left:0;width:100%;height:100%;"
src="http://www.youtube-nocookie.com/embed/{{id}}?rel=0"
frameborder="0" allowfullscreen mozallowfullscreen webkitallowfullscreen>
</iframe>
</div>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment