【问题标题】:Google Map Api - IE - size mapGoogle Map Api - IE - 大小地图
【发布时间】:2015-10-19 21:32:24
【问题描述】:

我使用的是 Google Map API v3,但只有 IE 有问题。

我有一个带有 2 个块“table-cell”的块“table”。在表格单元格中,我有地图,但是,我没有看到地图。

问题是高度为 100% 的“gm-style”块,我们看不到地图。 如果我将高度更改 250 像素(示例),我们会看到地图。

如何使用“table”和“table-cell”块调整这个块的高度?

谢谢!

Example here on jsfiddle

<style>
.table { 
    width: 100%; 
    display: table; 
}
.table-cell {
    display: table-cell;
    width: 50%;
    vertical-align: top;
}

</style>
<script src="//maps.googleapis.com/maps/api/js?v=3"></script>
<div class="table">
    <div class="table-cell" id="map"></div>
    <div class="table-cell" style="height: 250px;">
        Cell 2
    </div>
</div>
<script>
// Create map
map = new google.maps.Map(document.getElementById('map'), {
    zoom: 4,
    center: new google.maps.LatLng(-30, 145.5),
    mapTypeId: google.maps.MapTypeId.ROADMAP
});
</script>

【问题讨论】:

    标签: javascript css internet-explorer google-maps-api-3


    【解决方案1】:

    我认为 IE 无法将 Google 地图显示为 display: table-cell;

    我将谷歌地图推入一层,它似乎可以工作。也看看这个:http://jsfiddle.net/1s5d0f5d/1/

    【讨论】:

    • 是的,这是一个解决方案,但是,在我的代码中,高度总是不同的(高度图 = 高度右块)
    猜你喜欢
    • 1970-01-01
    • 2013-08-23
    • 2012-01-27
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2013-05-23
    • 2013-07-10
    • 2011-11-05
    相关资源
    最近更新 更多