I loaded Google Maps API v3 and print Google Map in div
. But when set width & height to 100% and auto I can't see the Map.
Here is HTML code snippet.
<!-- Maps Container -->
<div id="map_canvas" style="height:100%;width:100px;margin:0 auto;"></div>
Is there a way to fix this issue?
Gmap writes inline style position to relative to the div. Overwrite that with :
Hope it helps.
Better late than never! I made mine a class:
and then
Very few people realize the power of css positioning. To set the map to occupy 100% height of it's parent container do following:
If you have any non absolutely positioned elements inside #map_canvas_container they will set the height of it and the map will take the exact available space.
This worked for me.
map_canvas {position: absolute; top: 0; right: 0; bottom: 0; left: 0;}
I just added inline style .
<div id="map_canvas" style="width:750px;height:484px;"></div>
And it worked for me .
You can set height to -webkit-fill-available