Skip to content

Instantly share code, notes, and snippets.

@steveosoule
Created July 22, 2013 17:32
Show Gist options
  • Save steveosoule/6055834 to your computer and use it in GitHub Desktop.
Save steveosoule/6055834 to your computer and use it in GitHub Desktop.
Responsively Embed YouTube, Vimeo, Google Maps, Iframes, and More
<!-- FROM: http://embedresponsively.com/ -->
<!-- YouTube Responsive Embed -->
<style>.embed-container {position: relative; padding-bottom: 56.25%; padding-top: 30px; height: 0; overflow: hidden;} .embed-container iframe, .embed-container object, .embed-container embed { position: absolute; top: 0; left: 0; width: 100%; height: 100%; }</style>
<div class='embed-container'>
<iframe src='http://www.youtube.com/embed/' frameborder='0' allowfullscreen></iframe>
</div>
<!-- Vimeo Responsive Embed -->
<style>.embed-container {position: relative; padding-bottom: 56.25%; padding-top: 30px; height: 0; overflow: hidden;} .embed-container iframe, .embed-container object, .embed-container embed { position: absolute; top: 0; left: 0; width: 100%; height: 100%; }</style>
<div class='embed-container'>
<iframe src='http://player.vimeo.com/video/' frameborder='0' webkitAllowFullScreen mozallowfullscreen allowFullScreen></iframe>
</div>
<!-- Google Maps Responsive Embed -->
<style>.embed-container {position: relative; padding-bottom: 56.25%; padding-top: 30px; height: 0; overflow: hidden;} .embed-container iframe, .embed-container object, .embed-container embed { position: absolute; top: 0; left: 0; width: 100%; height: 100%; }</style>
<div class='embed-container'></div>
<!-- Generic Iframe Responsive Embed -->
<!-- NOTE: You may want to remove any hard coded values you see below with regards to "width" and "height" in the below code. These values may be in the iFrame SRC parameters, or in the iFrame query string. Experiment to see what works best. -->
<style>.embed-container {position: relative; padding-bottom: 56.25%; padding-top: 30px; height: 0; overflow: hidden;} .embed-container iframe, .embed-container object, .embed-container embed { position: absolute; top: 0; left: 0; width: 100%; height: 100%; }</style>
<div class='embed-container'></div>
@michalpa2
Copy link

michalpa2

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment