HTML iframe - 禁用滚动 [英] HTML iframe - disable scroll
问题描述
我的网站中有以下iframe:
I have following iframe in my site:
<iframe src="<<URL>>" height="800" width="800" sandbox="allow-same-origin allow-scripts allow-forms" scrolling="no" style="overflow: hidden"></iframe>
它有滚动条。
如何摆脱它们? / p>
And it has scrolling bars.
How to get rid of them?
推荐答案
不幸的是,我不相信只有HTML和CSS属性才能完全符合HTML5。幸运的是,大多数浏览器仍然支持滚动
属性(已从 HTML5规范)。
Unfortunately I do not believe it's possible in fully-conforming HTML5 with just HTML and CSS properties. Fortunately however, most browsers do still support the scrolling
property (which was removed from the HTML5 specification).
溢出
目前的解决方案是将两个:
A current solution would be to combine the two:
<iframe src="" scrolling="no"></iframe>
iframe { overflow:hidden; }
但是这可能会因浏览器更新而过时。您可能需要查看JavaScript解决方案: http://www.christersvensson.com/html-tool/iframe .htm
But this could be rendered obsolete as browsers update. You may want to check this for a JavaScript solution: http://www.christersvensson.com/html-tool/iframe.htm
编辑:我已选中, scrolling =no
将在IE10,Chrome 25和Opera 12.12中使用。
I've checked and scrolling="no"
will work in IE10, Chrome 25 and Opera 12.12.
这篇关于HTML iframe - 禁用滚动的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!