Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

google maps fullscreen

Im trying to get google maps to show 100% width and height. I have search several examples but cannot get it to work. The page it here

http://o-meter.dk/geo2.html

I used this css in the head

<style type="text/css">
html, body { height:100%; }
</style>

and this in the map div inline

<div id="map" style="width:100%; height:100%;">indenfor</div>

The map dosnt show

If i do this instead

<div id="map" style="width:500px; height:500px;">indenfor</div>

then the maps shows in 500x500 pixels.

what am i doing wrong ?

like image 515
Tonny Jørgensen Avatar asked Dec 08 '22 21:12

Tonny Jørgensen


2 Answers

I used the following css:

#map_canvas {
    width:100%;
    height:100%;
    position: absolute;
    top: 0px;
    left: 0px;
}
like image 84
Cardazio Avatar answered Feb 24 '23 17:02

Cardazio


The map needs both a height and a width.

<style type="text/css">
html, body { height:100%; width:100%;}
</style>
like image 43
geocodezip Avatar answered Feb 24 '23 19:02

geocodezip