html - 带有嵌入式 Google 日历的 iFrame 在 iOS 中旋转后溢出
问题描述
我使用 iframe 在网站中嵌入了 Google 日历。一切都在浏览器上完美调整大小,但在 iPhone 上,当从垂直旋转到水平并返回垂直时,嵌入的日历会垂直溢出 iframe。因为它是 CMS,所以我只能访问此站点上的 HTML 和 CSS。
HTML如下:
<p class="iframe-container"><iframe allowfullscreen="" frameborder="0" src="https://calendar.google.com/calendar/embed?" width="100%"> . </iframe></p>
CSS如下:
.iframe-container {
width: 100%;
overflow: hidden;
padding-top: 100%;
position: relative;
}
.iframe-container iframe {
border: 0;
height: 100%;
left: 0;
position: absolute;
top: 0;
width: 100%;
}
解决方案
经过数周的寻找,我通过反复试验找到了解决方案,但不知道为什么它现在可以工作。仍然希望从有经验的人那里听到为什么这可以解决问题。
HTML如下:
<div class="googleCalendar"><iframe frameborder="0" src="https://calendar.google.com/calendar/embed?"></iframe></div>
CSS如下:
.googleCalendar{
position: relative;
height: 0;
width: 100%
overflow: hidden;
padding-bottom: 100%;
}
.googleCalendar iframe {
position: absolute;
top: 0;
left: 0;
width: 100%;
height: 100%;
border: 0;
overflow: hidden;
padding-bottom: 100%;
}
推荐阅读
- html - 知道最大行数的自动调整项目大小
- php - 转换为数组或集合或列表
- c# - 无法定义两个对象之间的关系,因为它们附加到不同的 ObjectContext 对象实体框架
- javascript - 预输入插件无法识别 POST 响应
- ios - Xcode UI 测试崩溃为存在、isHittable、waitForExistence 和录制
- python - 在标签后立即获取文本
- r - R - 基于两个条件将字符串添加到新列的最佳方法
- python - 如何在scrapy函数中运行这两个项目?
- android - Android ReCaptcha:未显示复选框
- scala - scala尾递归装饰器不允许调用尾递归函数