Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

General Discussion

Google Maps API... Pulling my hair out! :)

I've spent 2 hours trying to figure how to get my maps responsive.

Anybody have any code snippets that could help me out?

Cheers.

2 Answers

If I understood your problem correctly,

<div class="map">
<center>
    <iframe src="https://www.google.com/maps/embed?pb=!1m18!1m12!1m3!1d4740.688850990047!2d-118.40631383193103!3d33.74772884283069!2m3!1f0!2f0!3f0!3m2!1i1024!2i768!4f13.1!3m3!1m2!1s0x80dd4c1b2ecf9e91%3A0x2bc910ff9a3c3819!2s20+V%C3%ADa+Capri%2C+Rancho+Palos+Verdes%2C+CA+90275!5e0!3m2!1sen!2sus!4v1447225826589" width="73%" height="350" frameborder="0" style="border:0" allowfullscreen></iframe>
</center>
</div>
#map {
   max-width: 760px;
}

If you see in the html iframe, there is width set to 73%. This means 73% of the screen.

In the css, you can set the max-width for the bigger desk top screens.

Hi Jonathan,

sorry my explanation was poor.

This does work, but the pin doesn't stay in view at smaller screen sizes.

Joe