【发布时间】:2017-04-05 20:26:10
【问题描述】:
我在我的网站上使用以下 iframe 代码。
.callrates {
position: relative;
padding-bottom: 56.25%;
padding-top: 35px;
height: 0;
overflow: scroll !important;
-webkit-overflow-scrolling:touch !important;
height:500px;
}
.callrates iframe {
position: relative;
top:0;
left: 0;
width: 100%;
height: 100%;
}
<div class="callrates">
<iframe src="https://www.xyz.php" width="200px" height="0" allowfullscreen=" " frameborder="0" scroll="no"></iframe>
</div>
问题是当我从移动设备纵向查看它时,iframe 的宽度大于屏幕尺寸,因此使其水平和垂直滚动。我希望整个宽度适合屏幕。我该怎么做?
【问题讨论】:
-
iframe 的 width 属性为 200px,其优先级高于 CSS width: 100%。
-
即使我将该宽度属性更改为任何值,它也不会改变任何内容。问题仍然存在。我尝试将宽度属性保持为空白甚至“0”,但没有帮助。
标签: html css iframe width responsiveness