【发布时间】:2017-10-09 14:11:09
【问题描述】:
我的主站点上有一个响应式 IFrame,无法让内容显示 100% 高度。 Screen Shot。里面的图像应该是一个矩形。宽度显示正常,但 IFrame 要么将图像压缩到较短的长度,或者它可能只显示高度的较小正方形部分?请告知我做错了什么,或者可以做什么,所以内容显示 IFRAME 的 100% 的宽度和 100% 的高度
提前谢谢你!! :)
这是 IFrame 页面的链接:https://www.pravacanamats.com/custom-yoga-mat-designer/
这里还有当前使用的代码 html 和 CSS:
<div class="iframe-container iframe-container-for-wxh-500x350" style="-webkit-overflow-scrolling: touch; overflow: auto;">
<iframe src="https://www.beehoneyom.com/product/yoga-mat/"> <iframe src= marginheight="1" height="1">
<p style="font-size: 110%;"><em><strong>IFRAME: </strong> There is iframe content being displayed here but your browser version does not support iframes.</em>Please update your browser to its most recent version and try again.</p> </iframe>
</div>
<iframe width="100%" height="768" src="https://www.beehoneyom.com/product/yoga-mat/" frameborder="0" allowfullscreen></iframe>
【问题讨论】:
-
这里也是 CSS 代码: .iframe-container-for-wxh-500x350 { padding: 25px 25px 70% 25px; /* padding-bottom = h/w as a % / } .iframe-container iframe { position: absolute;最高:50;左:0;边距:0;填充:0;宽度:100%;高度:100%;边框:无; / 将以下样式(溢出和滚动处理所必需)放在 iframe 周围的 div 容器中,因为在 CSS 中不稳定 -webkit-overflow-scrolling: touch;溢出:自动; */ }
-
您的网站需要很长时间才能加载!
-
如果你看到这里,那是一团糟。 > src="beehoneyom.com/product/yoga-mat" frameborder="0" allowfullscreen>
-
正如@techLove 所说,您将 iframe 高度限制为 768 像素。将其更改为 height="100%"。
-
jsfiddle.net/RachGal/02m1x2e6 这可行,但您应该处理加载时间 - 这需要很长时间..人们会从您的网站反弹..添加文本/图像等较小是否有问题?您无法从 iframe 端控制它,因为它是其他网站的一部分..