Chrome 中的 iframe 中删除垂直滚动条,保留水平滚动条
我有一个 iframe,我想为其启用水平滚动条,但禁用垂直滚动条。
我的 iframe 样式如下:overflow-y:hidden; Overflow-x:auto;
这在 FireFox 中工作得很好,但在 Chrome 中却不行。有什么解决方法可以让它在 Chrome 中工作吗?
更新: 我已经转而使用带有溢出的表格单元格,而不是 iframe。我不知道这是否会让垂直滚动变得更容易或更困难。
I have an iframe for which I would like to enable a horizontal scroll bar, but disable the vertical scroll bar.
I have the iframe styled as such: overflow-y:hidden; overflow-x:auto;
This works just fine in FireFox, but not Chrome. Is there any sort of workaround to get this to work in Chrome?
Update:
I have transitioned into using a table cell with overflow, rather than an iframe. I don't know if this will make it easier or harder to work around that vertical scroll.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(4)
答案实际上在这里:
Safari/Chrome (Webkit) - 无法隐藏 iframe 垂直滚动条
祝你好运!!
The answer is actually here:
Safari/Chrome (Webkit) - Cannot hide iframe vertical scrollbar
Good luck!!
这在任何浏览器中都适用
This works well in any browser
如果找不到其他内容:
将 iframe 的高度设置为 =>103%
请参阅此处:
http://forums.aspfree.com/web-layout-43/horizontal-scrollbar-iframe-removing-23237-2.html
这是解决方法可能会起作用...
你告诉我!
祝你好运
If you cant find anything else:
Put the height of the iframe to =>103%
See here:
http://forums.aspfree.com/web-layout-43/horizontal-scrollbar-iframe-removing-23237-2.html
It is workaround that might just work...
You tell me!
Good luck
将父 div 元素添加到 iframe 中,如下所示:
它将隐藏垂直滚动条,但用户仍然可以使用“向上翻页”、“向下翻页”和箭头键< /strong> 垂直滚动选项。
Add parent div element to iframe like this:
It will hide vertical scroll bar but user could still use 'page up', 'page down' and arrow keys options for vertical scrolling.