Javascript 如何删除 iframe 的滚动条?
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/4460844/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
How to remove iframe's scrollbars?
提问by Paul
How to remove iframe's scrllbars? In Firefox it's easy, however I found myself unable to achieve this effect to be compatible with all major browsers.
如何删除 iframe 的滚动条?在 Firefox 中很容易,但是我发现自己无法实现与所有主要浏览器兼容的效果。
采纳答案by alex
CSS
CSS
iframe {
overflow: hidden;
}
And/or use Coin_op's answer, it seems to be better.
和/或使用Coin_op's answer,它似乎更好。
回答by Coin_op
If the CSS technique isn't working for you, try also adding the property scrolling="no"
to the iframe
HTML tag.
如果 CSS 技术不适合您,请尝试将该属性添加scrolling="no"
到iframe
HTML 标记中。
<iframe scrolling="no" src="..." >
回答by Aris
on top of Alex's answer, I also had to add the following to remove horizontal toolbars from both FF and Chrome. This was added in the i-frame page, even though it should be possible to add it in the css as well:
在 Alex 的回答之上,我还必须添加以下内容以从 FF 和 Chrome 中删除水平工具栏。这是在 i-frame 页面中添加的,即使它也应该可以添加到 css 中:
<style>
iframe::-webkit-scrollbar {
display: none;
}
</style>
回答by DjZia Prodigal Son
<iframe runat="server" id="_theFrame" src="url" width="100%" scrolling="no" height="200" frameborder="0" allowtransparency="true" marginwidth="0" marginheight="0" style="display: block; background: none repeat scroll 0% 0% transparent; width: 100%;" />