Note that there are some explanatory texts on larger screens.

plurals
  1. POGoogle Maps breaks with % instead of px dimensions
    primarykey
    data
    text
    <p>I'm making a page using the Google Maps API v3, similar to <a href="http://code.google.com/apis/maps/documentation/v3/examples/marker-simple.html" rel="nofollow noreferrer">Google's example</a>. I want the map to fill up the entire viewport, but when I set its width and height to 100%, it doesn't appear. Setting at least one dimension in px, though, makes it work. I'm using Firefox 3.5.6 and Internet Explorer 8. Now I want to get the page to work, but I'm also curious as to why on Earth this bug occurs.</p> <pre><code>&lt;!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd"&gt; &lt;html lang="en" dir="ltr"&gt; &lt;head&gt; &lt;meta http-equiv="Content-Type" content="text/html; charset=UTF-8"&gt; &lt;meta name="viewport" content="initial-scale=1.0, user-scalable=no"&gt; &lt;title&gt;Map&lt;/title&gt; &lt;style type="text/css"&gt; html, body { margin: 0; padding: 0; } #map { width: 100%; /* Using % instead of px breaks the map, I don't know why. */ height: 500px; } &lt;/style&gt; &lt;script type="text/javascript" src="http://maps.google.com/maps/api/js?sensor=false"&gt;&lt;/script&gt; &lt;script type="text/javascript"&gt; function initialize() { var myLatLon = new google.maps.LatLng(36, -111); var myOptions = { zoom: 7, center: myLatLon, mapTypeId: google.maps.MapTypeId.TERRAIN } var map = new google.maps.Map(document.getElementById("map"), myOptions); } &lt;/script&gt; &lt;/head&gt; &lt;body onload="initialize();"&gt; &lt;div id="map"&gt;Loading...&lt;/div&gt; &lt;/body&gt; &lt;/html&gt; </code></pre>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload