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
Jacob Thomson
757 PointsGoogle Maps
I have been trying to import Google Maps into my website, and I'm using a site then automatically generates the code. It offers you the height and width you would like your map. I want my map to stretch and fill 100% of its container, but I dont know what to change to make that happen within this code:
<script type="text/javascript" src="http://maps.google.com/maps/api/js?sensor=false"></script><div style="overflow:hidden;height:300px;width:600px;"><div id="gmap_canvas" style="height:300px;width:600px;"></div><style>#gmap_canvas img{max-width:none!important;background:none!important}</style><a class="google-map-code" href="http://goertz-gutschein-map.com" id="get-map-data">http://goertz-gutschein-map.com</a></div><script type="text/javascript"> function init_map(){var myOptions = {zoom:15,center:new google.maps.LatLng(-28.0172605,153.4256987),mapTypeId: google.maps.MapTypeId.ROADMAP};map = new google.maps.Map(document.getElementById("gmap_canvas"), myOptions);marker = new google.maps.Marker({map: map,position: new google.maps.LatLng(-28.0172605, 153.4256987)});infowindow = new google.maps.InfoWindow({content:"<b></b><br/><br/> Gold Coast" });google.maps.event.addListener(marker, "click", function(){infowindow.open(map,marker);});infowindow.open(map,marker);}google.maps.event.addDomListener(window, 'load', init_map);</script>
1 Answer
Andrew Claytor
6,637 Pointsdid you put the inside of a container element and set the height and width to 100%?
Christian Lawrence
3,941 PointsChristian Lawrence
3,941 PointsThis might be better in the HTML or Javascript forums