嵌入式谷歌地图底部的空白区域

0 html css iframe google-maps

我是 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;
}
Run Code Online (Sandbox Code Playgroud)

小智 7

我解决了这个问题,将以下样式代码直接添加到嵌入的 iframe 中:

display: block;
Run Code Online (Sandbox Code Playgroud)

我还使用 CSS 类应用了它,也正确填充了屏幕。响应行为没问题。

希望能帮助到你!