Google地图div未显示在JSBin中 [英] Google Maps div not showing up in JSBin
问题描述
如果我将宽度设置为500px,则可以在单击我的开始按钮时显示地图画布div。如果我将高度/宽度设置为100%,则不会显示出来。
If I set my width to 500px, I can get the map-canvas div to show up when I click my "get started" button. If I set my height/width to 100%, it doesn't show up.
我想确保我的项目会加载到移动设备上, t要使用绝对尺寸。
I want to be sure my project will load on a mobile device so I don't want to use absolute dimensions.
http://jsbin.com/OpujukIF/1/edit?html,css,output
推荐答案
使用可以使用绝对定位而不需要 width |使用
top | left | bottom | right
并将 0
设置为其值这会导致#map-canvas
div
变成包含元素#的大小第二
,只要它被设置为相对的就像这样:
Use can use absolute positioning without a width | height
value, using top|left|bottom|right
with 0
set as their values which would result in the #map-canvas
div
becoming the size of the containing element #second
as long as it is set to relative like so:
#second {
position: relative;
}
#map-canvas {
position: absolute;
top: 0; bottom: 0;
left: 0; right: 0;
}
以下是 updated bin 。
我希望这有助于!
这篇关于Google地图div未显示在JSBin中的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!