How to add scrollbars in iframe

非 Y 不嫁゛ 提交于 2019-12-13 12:01:24

问题


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>

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.

Thanks


回答1:


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>.

Use CSS instead:

iframe {
    overflow: scroll;
    width: 1349px;
    height: 100%;
    border: 1px solid black;
}

But actually all browsers show the scrollbars right away if needed.

Demo

Try before buy




回答2:


you were missing scrolling="yes" in your code try the following code

<iframe src="http://www.w3schools.com"  width="1349px" height="100%" scrolling="yes">
</iframe>



回答3:


Change the scrolling attribute to

scrolling="yes"



回答4:


Change scrolling="auto" to scrolling="yes" and add frameborder="1"

Try the style:

iframe {
   border: 1px solid #000 !important;
   overflow: scroll !important;
}



回答5:


This is not an issue with Firefox, ie, or edge.

The way i solved my particular issue is removing a class's overflow: auto and replacing it with the following on the parent of (in my current case) a table

class {
 overflow-y: scroll !important;
}


来源:https://stackoverflow.com/questions/18355060/how-to-add-scrollbars-in-iframe

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!