最佳答案
是的,这可以通过CSS定位轻松完成.考虑以下简短示例:
原文链接:https://www.f2er.com/css/530795.html<!DOCTYPE html>
<html>
<head>
<Meta http-equiv="content-type" content="text/html; charset=UTF-8"/>
<title>Google Maps v2 API: Floating Div</title>
<script src="http://maps.google.com/maps?file=api&v=2&sensor=false"
type="text/javascript"></script>
</head>
<body onunload="GUnload()">
<div style="position: relative;">
<div id="map_canvas" style="width: 400px; height: 300px;"></div>
<div style="position: absolute; top: 0px;
width: 100px; height: 100px; background-color: grey;">
Menu Here
</div>
</div>
<script type="text/javascript">
var map = new GMap2(document.getElementById("map_canvas"));
map.setCenter(new GLatLng(38.00,-100.00),3);
</script>
</body>
</html>
屏幕截图: