嘗試添加
<div id="map_30" style="height:200px; width:200px;
float:left; padding: 0px; margin: 0px;"></div>
我已經試過這一點,工作細(小200x200的地圖在頁面的左上角)
<!DOCTYPE html>
<html>
<head>
<meta name="viewport" content="initial-scale=1.0, user-scalable=no">
<meta charset="utf-8">
<title>Info windows</title>
<style>
html, body {
height: 100%;
margin: 0;
padding: 0;
}
#map {
height: 100%;
}
</style>
</head>
<body>
<div id="map_30" style="height:200px; width:200px; float:left; padding: 0px; margin: 0px;"></div>
<script>
function initialize() {
//Map parametrs
var mapOptions_place = {
zoom: 6,
center: new google.maps.LatLng(-16.39, -71.83),
mapTypeId: google.maps.MapTypeId.ROADMAP,
mapTypeControl: false,
mapTypeControlOptions: {
style: google.maps.MapTypeControlStyle.HORIZONTAL_BAR,
position: google.maps.ControlPosition.BOTTOM_CENTER
},
panControl: false,
panControlOptions: {
position: google.maps.ControlPosition.TOP_RIGHT
},
zoomControl: false,
zoomControlOptions: {
style: google.maps.ZoomControlStyle.LARGE,
position: google.maps.ControlPosition.TOP_RIGHT
},
scaleControl: false,
scaleControlOptions: {
position: google.maps.ControlPosition.TOP_LEFT
},
streetViewControl: false,
streetViewControlOptions: {
position: google.maps.ControlPosition.LEFT_TOP
},
scrollwheel: false
}
//map
var map_place = new google.maps.Map(document.getElementById("map_30"), mapOptions_place);
var quake_3 = 'img/map-icons/quake-3.png';
var quake_4 = 'img/map-icons/quake-4.png';
var quake_5 = 'img/map-icons/quake-5.png';
var quake_6 = 'img/map-icons/quake-6.png';
var quake_7 = 'img/map-icons/quake-7.png';
var quake_8 = 'img/map-icons/quake-8.png';
//positions
var point_place = new google.maps.LatLng(-16.39, -71.83);
//markers
var marker_place = className = 'Test';
var marker_place = new google.maps.Marker({
position: point_place,
map: map_place,
category: quake_3,
title: "point_place"
});
};
//google.maps.event.addDomListener(window, 'load', initialize);
</script>
<script async defer
src="https://maps.googleapis.com/maps/api/js?callback=initialize"></script>
</body>
</html>
請張貼小提示所以我們可以看到問題 –
請提供一個[最小,完整,已測試和可讀的示例](http://stackoverflow.com/help/mcve)來說明您的問題。 [您發佈的「代碼」到目前爲止不是](http://jsfiddle.net/geocodezip/o85nx8x0/)(但它可能是一個CSS問題) – geocodezip