HTML5:iframe没有滚动? [英] HTML5 : Iframe No scrolling?
问题描述
在HTML5中,不再支持滚动属性 - 但我仍然需要删除滚动条 - 如何做到这一点? 解决方案
在HTML5中没有滚动属性,因为它的功能更好地由CSS处理,请参阅 http:/其他更改请参见http://www.w3.org/TR/html5-diff/ 。好的和CSS解决方案:
CSS解决方案: HTML4的 scrolling =no
是CSS的 overflow:hidden
的别名,为此,设置大小属性很重要width / height:
iframe.noScrolling {
width:250px; / *或任何其他尺寸* /
身高:300px; / *或任何其他大小* /
溢出:隐藏;
}
将这个类添加到您的iframe中,您就完成了:
< iframe src =http://www.example.com/class =noScrolling> ;< / iframe中>
!重要的提示 ! : > overflow:hidden
for < iframe>
尚未完全受所有现代浏览器支持(甚至chrome目前还不支持),所以现在( 2013 )最好使用 Transitional 版本并使用 scrolling =no
和 overflow:hidden
同时:)
When it comes to HTML5, scrolling attribute is no longer supported - but I still need to remove the scroll bars - how to do that?
In HTML5 there is no scrolling attribute because "its function is better handled by CSS" see http://www.w3.org/TR/html5-diff/ for other changes. Well and the CSS solution:
CSS solution:
HTML4's scrolling="no"
is kind of an alias of the CSS's overflow: hidden
, to do so it is important to set size attributes width/height:
iframe.noScrolling{
width: 250px; /*or any other size*/
height: 300px; /*or any other size*/
overflow: hidden;
}
Add this class to your iframe and you're done:
<iframe src="http://www.example.com/" class="noScrolling"></iframe>
! IMPORTANT NOTE ! : overflow: hidden
for <iframe>
is not fully supported by all modern browsers yet(even chrome doesn't support it yet) so for now (2013) it's still better to use Transitional version and use scrolling="no"
and overflow:hidden
at the same time :)
这篇关于HTML5:iframe没有滚动?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!