Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save sshyran/6b17bda412881977328c to your computer and use it in GitHub Desktop.
Save sshyran/6b17bda412881977328c to your computer and use it in GitHub Desktop.
Fluid Map Maintaining Aspect Ratio
<!--Pattern HTML-->
<div id="pattern" class="pattern">
<div class="map">
<iframe width="650" height="100" frameborder="0" scrolling="no" marginheight="0" marginwidth="0" src="https://maps.google.com/maps?f=q&amp;source=s_q&amp;hl=en&amp;geocode=&amp;q=&amp;aq=0&amp;oq=pittsburgh&amp;sll=40.440625,-79.995886&amp;sspn=0.166706,0.363579&amp;ie=UTF8&amp;ll=40.697488,-73.979681&amp;spn=0.664273,1.454315&amp;t=m&amp;z=10&amp;output=embed"></iframe><br /><small><a href="https://maps.google.com/maps?f=q&amp;source=embed&amp;hl=en&amp;geocode=&amp;q=&amp;aq=0&amp;oq=pittsburgh&amp;sll=40.440625,-79.995886&amp;sspn=0.166706,0.363579&amp;ie=UTF8&amp;ll=40.697488,-73.979681&amp;spn=0.664273,1.454315&amp;t=m&amp;z=10" style="color:#0000FF;text-align:left">View Larger Map</a></small>
</div>
</div>
<!--End Pattern HTML-->
<div class="container">
<section class="pattern-description">
<h1>Fluid Map Maintaining Aspect Ratio</h1>
<p>Creating a fluid map that preserves aspect ratio by using <a href="http://codepen.io/chriscoyier/pen/115">Google Maps with Uncle Dave's Ol' Padded Box</a></p>
<h2>Resources</h2>
<ul>
<li><a href="http://daverupert.com/2012/04/uncle-daves-ol-padded-box/">Uncle Dave’s Ol’ Padded Box</a></li>
<li><a href="http://codepen.io/chriscoyier/pen/115">Google Maps with Uncle Dave’s Ol’ Padded Box by Chris Coyier</a></li>
</ul>
</section>
<footer role="contentinfo">
<div>
<nav id="menu">
<a href="http://bradfrost.github.com/this-is-responsive/patterns.html">&larr;More Responsive Patterns</a>
</nav>
</div>
</footer>
</div>
.map {
width: 90%;
height: 0;
margin: 0 auto;
padding-top: 33.33%;
position: relative;
}
.map iframe {
width: 100%;
height: 100%; /* had to specify height/width */
position: absolute;
top: 0;
right: 0;
left: 0;
bottom: 0;
}
<link href="http://bradfrost.github.com/this-is-responsive/styles.css" rel="stylesheet" />
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment