Google Maps does not show

I have a Google map that will not appear. The problem seems the same in FF and Chrome, but even more “bad” in IE (always the latest version).

In FF and Chrome, I had a problem with the position: relative;css element style . As soon as I switch (with dev tools) position: absolute(or: fixed);everything is displayed in FF. In Chrome, only the top 30% (top) is displayed on the map.

In IE, the map does not even load.

Here is the script material from <head>. Content is for testing purposes only and does not mean anything. Note. I use this only to download maps. It will be replaced later.

<!-- Script inside <head> tag -->
    <script type="text/javascript" src="http://maps.google.com/maps/api/js?
        file=api&amp;
        v=2&amp;
        key=<?php echo self::GOOGLE_API_KEY; ?>&amp;
        sensor=false">
    </script>
    <script type="text/javascript">
    function initialize() 
    {
        var startpos = new google.maps.LatLng( 50.978056,11.029167 );
        var ops = { 
             zoom:      6
            ,center:    startpos
            ,mapTypeId: 
                 google.maps.MapTypeId.ROADMAP
                ,tileSize: new google.maps.Size( 256, 256 )
        }
        var map = new google.maps.Map( document.getElementById("map_canvas"), ops );
        var pos1 = new google.maps.LatLng( 50.7510776,12.4820724 );
        var contentString1 = '<div align="left" dir="ltr" class="infowin"><h3>test</h3>testen</div>';
        var infowindow1 = new google.maps.InfoWindow( {
             content:   contentString1
            ,maxWidth:  5
        } );
        var marker1 = new google.maps.Marker( { 
             position:  pos1
            ,map:       map
            ,title: 'test' 
        } );
        google.maps.event.addListener(
             marker1
            ,'click'
            ,function() { 
                infowindow1.open( map, marker1 );
            }
        );
    }
    </script>

This is the whole mark for the page.

<!-- html markup - There *really* isn't anything else -->
<body onload="initialize()">
<div id="map_canvas" style="width:100%; height:100%;"></div>
</body>

I spent a lot of time on Google without finding anything. Any ideas? Thank!

+5
2

html, body height:100%;.

, , height:100%;

html body .

:

<html>
<head>
  <style>
      html, body { height:100%; }
  </style>
</head>
<body>

<div id="wrapper">
     <div id="google-map-holder" style="width:100%; height:100%;"></div>
</div>

</body>
</html>

, - . height:100%; .

, , #google-map-holder , height:100%; #wrapper.

IF, #google-map-holder #wrapper, body, html, body .

+19

height: 100%; #map_canvas.

<head> ( Firefox 5 Safari 5.1):

<style>
  html, body {
    height: 100%;
  }
</style>

, , :

Div 100% Firefox, IE

+2

All Articles