如何在iframe中添加滚动条 [英] How to add scrollbars in iframe
问题描述
我想在iframe中添加滚动条。以下是我的代码。
I want to add scrollbars in my iframe. Below is my code.
<iframe src="http://www.w3schools.com" width="1349px" height="100%" scrolling="auto">
</iframe>
我在Drupal 7中写这个。问题是它没有显示带有滚动条和边框的iframe。之前我只是设置了没有宽度和高度的源以及滚动选项,它显示了带有滚动条的iframe,但在添加宽度和高度后,它消失了。
I am writing this in Drupal 7. Problem is it doesn't show iframe with scrollbars and border. Earlier I simply set the source without width and height and scrolling options and it showed iframe with scrollbars but after adding width and height,it disappeared.
谢谢
推荐答案
scrolling =是
以及 frameborder
不再是有效的HTML5属性。它们在允许的属性列表中找不到,请参阅: W3C:4.7 0.6。 iframe元素或 MDN:< iframe> 。
scrolling="yes"
and also frameborder
aren't valid HTML5 attributes anymore. They can't be found in the list of allowed attributes, see: W3C: 4.7.6. The iframe element or MDN: <iframe>.
使用CSS代替:
iframe {
overflow: scroll;
width: 1349px;
height: 100%;
border: 1px solid black;
}
但实际上所有浏览器都会在需要时立即显示滚动条。
But actually all browsers show the scrollbars right away if needed.
演示
这篇关于如何在iframe中添加滚动条的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!