Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to add scrollbars in iframe

Tags:

html

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>

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

like image 284
bsm Avatar asked Aug 21 '13 10:08

bsm


1 Answers

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

like image 165
insertusernamehere Avatar answered Oct 02 '22 19:10

insertusernamehere