iOS 会自动将可滚动 iFrame 的大小调整为 iFrame 内容的整个高度。
我已经在应用到 div 和 iFrame 的头部混合使用内联样式和样式来修复它,但是当尝试移动样式时,所有样式都移动到头部并将 ID 分配给 Div 和 iFrame,修复无效。
这个有效:
<html>
<head>
<style>
iframe {
height: 600px !important;
}
</style>
</head>
<body>
<div style="overflow: auto; -webkit-overflow-scrolling:touch;"><iframe src="//www.google.com/" width="100%" height="600px"></iframe></div>
</body>
</html>
这行不通:
<html>
<head>
<style>
#iOSiFrameFix {
height: 600px !important;
width: 100% !important;
}
#iOSDivFix {
overflow: auto !important;
-webkit-overflow-scrolling:touch !important;
}
</style>
</head>
<body>
<div id="iOSDivFix"><iframe id="iOSiFrameFix" src="//www.google.com/"></iframe></div>
</body>
</html>
我不确定我在这里做错了什么。由于某种原因,第二组代码没有应用修复。
最佳答案
两组代码均有效,失败的原因是我们的 CMS 中的发布设置配置错误。
关于html - iFrame 和 Div ID 无法按预期用于 iOS iFrame 修复,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/57525736/