【问题标题】:White space on the bottom of the embeded google maps嵌入式谷歌地图底部的空白
【发布时间】:2018-04-11 04:55:33
【问题描述】:

我是 CSS 新手,所以我从某个地方复制了这段代码来创建响应式嵌入式谷歌地图,但是在引入了以前没有的“max-height”属性后,页面底部有空白。

/* Flexible iFrame (for google maps)*/

.Flexible-container {
    position: relative;
    padding-bottom: 56.25%;
    padding-top: 30px;
    height: 0;
    overflow: hidden;
}

.Flexible-container iframe,
.Flexible-container object,
.Flexible-container embed {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    max-height: 500px;
}

【问题讨论】:

    标签: html css google-maps iframe


    【解决方案1】:

    移除 padding-bottom: 56.25%;来自你的 CSS

    【讨论】:

    • 谢谢,但它实际上降低了价值,因为如果我完全删除它,它会显示一个非常小的地图。
    • 给容器一个宽度
    【解决方案2】:

    我修复了这个问题,将以下样式代码直接添加到 iframe embed:

    display: block;
    

    我还使用 CSS 类应用了它,也正确地填充了屏幕。响应行为还可以。

    希望对你有帮助!

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2017-02-20
      • 2017-04-26
      • 2016-01-10
      • 2018-01-14
      • 1970-01-01
      相关资源
      最近更新 更多