I added a google map on my page here: http://www.comehike.com/outdoors/trees/trees.php?tree=43
But for some reason,开发者_StackOverflow I can't get 2 things right: 1) The page got shifted to the left 2) And I can't get the map to be the width of the page, and a set length in pixels - is that possible? Right now I just have style="width:750px; height:300px" for the map_canvas div.
Thanks, Alex
Regarding your page "shifting to the left," I noticed the following style at the top of the page:
body { height: 100%; width: 70%; margin: 0px; padding: 0px }
Are you certain you don't just want to remove the height and width specifiers? This will cram your page into 70% of the browser window width. I don't think this is a Google Maps issue. Not sure if that's the behavior you were describing.
As for the Google Maps width, remove "width: 750px;" from the inline style on div#map_canvas. Block level elements such as divs automatically span the full width of their container without any further intervention from CSS styles. You need only give it the height, otherwise a browser would render the div with height: 0px.
精彩评论