容器内的Google地图 [英] Google map inside container

查看:83
本文介绍了容器内的Google地图的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一些问题,将Google地图放在我的容器,它给我一些问题加载,当我把它放在任何我的容器,它只会工作在我所有的容器之外:(

i'm having some issues with placing Google map inside my Container, its giving some issue loading when i place it into any of my containers, it will only work outside of all my containers :(

<section class="lookingfor">
      <ul class="clearfix">
        <li class="homeMap">
            <div id="map_canvas" style="width: 100%; height: 100%"></div>
        </li>
      </ul>
    </section>

寻找课程:

section.lookingfor .skills div.text {font-family: 'Open Sans', sans-serif; color:#666; font-size:14px; line-height:22px;}
section.lookingfor ul li.homeMap {width: 100%; height: 100%;}

不确定第一行是否会影响:O

Not sure if the first line affects :O

清除字串:

.clearfix:after {    content: ".";    display: block;    height: 0;    clear: both;    visibility: hidden;    } 

homeMap类别:

homeMap class:

section.lookingfor ul li.homeMap {width: 100%; height: 100%;}

:)

推荐答案

设置

position:relative;

并使用固定高度&宽度而不是%,因为%会给你0高度。
这是因为div试图占据的大小的百分比,但默认情况下有一个不确定的高度。

and use fixed height&width instead of % because % will give you 0 height. "That's because the div tries to be a percentage of the size of the , but by default the has an indeterminate height."

将解决这个问题。感谢那些观看过的人:)

will fix the issue. Thanks to those who viewed :)

这篇关于容器内的Google地图的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆