所以,我在让 iframe 在移动设备上运行时遇到了很多问题。它只覆盖了大约一半或更多的屏幕。我怀疑这是因为我在 iframe 中放置了一些 CSS 行。
.Wrapper2 {
position: relative;
padding-bottom: 56.25%; /* 16:9 */
padding-top: 25px;
height: 0;
}
.Wrapper2 iframe {
position: absolute;
top: 0;
left: 0;
width: 100%;
height: 100%;
}
我还想为我的文本添加一点,我正在使用视口(viewport)大小调整(vw、vh、vmin、vmax),如果这有任何帮助的话,因为我也遇到了产生滚动条的长文本 block 的问题。我还认为 (???) 它可能与我的 iframe CSS 和/或文本大小调整有关。我需要实现的必要更改是什么?先感谢您!
最佳答案
请发布您的 html 以便我们更容易理解问题所在。
试试这个 - 如果你在 html 中查看你的 iframe 那么你会发现:
<iframe width="560" height="315" src="https://www.youtube.com/embed/HDI9inno86U" frameborder="0" allowfullscreen></iframe>
因此,iframe 元素内已经定义了宽度和高度。您只需将其更改为 width="100%"
;
关于html - 适用于手机的响应式 iframe,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/43069893/