Sid*_*rth 9 iframe google-chrome scrollbar
我正在使用IFrame来展示来自其他领域的一些内容.问题是我可以使用指定的高度和宽度(我正在使用),IFrame中的内容无法完全容纳在IFrame中.因此,我需要滚动条.
我使用了以下HTML代码 -
**<iframe style = "overflow-x:scroll; overflow-y:scroll;" src = "http://shopsocial.ly/merchant/fanpage?merchant_name=cafepress"
height = "400" width = "500">**
Run Code Online (Sandbox Code Playgroud)
这在Firefox中运行良好.但在Chrome中,我没有在IFrame中获得任何滚动条.我已经搜索过这个问题并尝试过很多东西,但都没有解决我的问题.有人可以帮我弄这个吗?
在您的 iframe 内容中添加内联:
<body style="overflow:auto;">
Run Code Online (Sandbox Code Playgroud)
或者在附加到 iframe 的 css 文件中
html, body {
overflow:auto;
}
Run Code Online (Sandbox Code Playgroud)
当然,按照 Tom 的建议,请确保在 iframe 上使用scrolling="yes"和:style="overflow:visible;"
<iframe scrolling="yes" src="http://example.com" style="overflow:visible;"></iframe>
Run Code Online (Sandbox Code Playgroud)
如果仍然不起作用,请尝试像这样包装 iframe:
<div style="overflow:visible; height:400px;">
<iframe scrolling="yes" src="http://example.com" style="overflow:visible; height:2000px;"></iframe>
</div>
Run Code Online (Sandbox Code Playgroud)
您可以使用iframe 的滚动yes属性并将其设置为(即始终显示滚动条),而不是使用 CSS 样式:
<iframe scrolling="yes" src="http://domain.com" height="400" width="500"></iframe>
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
29998 次 |
| 最近记录: |