【发布时间】:2016-06-09 23:49:44
【问题描述】:
我有一个正在输出网站的 iframe。 src网站使用100vh的大英雄来计算高度。在 iframe 中,除了 iOS 设备外,一切都很好。似乎英雄的 100vh 正在将 iframe 页面的整个高度拉伸到其他元素上,而不仅仅是当前视口。
HTML
<div class="wrapper">
<iframe src="[website url]"></iframe>
</div>
CSS
.wrapper{
height: 100%;
position: relative;
overflow: auto;
-webkit-overflow-scrolling: touch;
}
.wrapper iframe{
display: block;
width: 100vw;
height: 100vh;
max-width: 100%;
margin: 0;
padding: 0;
border: 0 none;
box-sizing: border-box;
}
body { margin:0 }
问题是在 iOS 上,来自 src 网站的 hero 部分会拉伸 iframe 的整个高度
HTML
<section class="hero">
</section>
CSS
background-size: cover !important;
background-position: center center !important;
position: relative;
height: 100vh;
这个问题似乎只存在于 iOS 中,在其他所有设备上都很好。
任何帮助都会很棒!
【问题讨论】: