设置Google地图容器DIV的宽度和高度100% [英] Set Google Maps Container DIV width and height 100%
本文介绍了设置Google地图容器DIV的宽度和高度100%的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我加载了Google Maps API v3,并在 div
中打印Google地图。但是当设置宽度&
这是HTML代码段。
<! - Maps Container - >
< div id =map_canvasstyle =height:100%; width:100px; margin:0 auto;>< / div>有没有办法解决这个问题?
$ b < h2_lin>解决方案
如果要覆盖整个页面,您必须将所有父容器设置为100%宽度。您必须至少为#content div的宽度和高度设置绝对值。
body,html {
height:100%;
width:100%;
}
div#content {
width:100%;高度:100%;
}
I loaded Google Maps API v3 and print Google Map in div
. But when set width & height to 100% and auto I can't see the Map.
Here is HTML code snippet.
<!-- Maps Container -->
<div id="map_canvas" style="height:100%;width:100px;margin:0 auto;"></div>
Is there a way to fix this issue?
解决方案
You have to set all parent containers to a 100% width if you want to cover the whole page with it. You have to set an absolute value at width and height for the #content div at the very least.
body, html {
height: 100%;
width: 100%;
}
div#content {
width: 100%; height: 100%;
}
这篇关于设置Google地图容器DIV的宽度和高度100%的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文