Skip to content

Instantly share code, notes, and snippets.

@deadlyhifi
Created April 23, 2013 10:40
Show Gist options
  • Save deadlyhifi/5442553 to your computer and use it in GitHub Desktop.
Save deadlyhifi/5442553 to your computer and use it in GitHub Desktop.
Responsive iframe width and height hack using an image to maintain the aspect ratio. Thanks to http://jsfiddle.net/Masau/7WRHM/
.map {
position: relative;
min-height: 200px;
.ratio {
display: block;
width: 100%;
height: auto;
}
iframe {
position: absolute;
top: 0;
left: 0;
width: 100%;
height: 100%;
}
}
<div class="col">
<div class="map">
<img class="ratio" src="inc/img/16x9.gif"/>
<iframe frameborder="0" scrolling="no" marginheight="0" marginwidth="0"></iframe>
</div>
</div>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment