Skip to content

Instantly share code, notes, and snippets.

@freeCodeCamp
Created December 3, 2014 21:41
Show Gist options
  • Save freeCodeCamp/2ae74e21567dc3b6ea20 to your computer and use it in GitHub Desktop.
Save freeCodeCamp/2ae74e21567dc3b6ea20 to your computer and use it in GitHub Desktop.
responsive iframe for youtube/vimeo videos
#html
<div class="responsive-container">
<iframe src='//player.vimeo.com/video/#{video}', frameborder='0', webkitallowfullscreen='', mozallowfullscreen='', allowfullscreen=''>
</div>
#css
.responsive-container { position: relative; padding-bottom: 56.25%; padding-top: 30px; height: 0; overflow: hidden; }
.responsive-container 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