Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Iframe - Vertical Scrolling Only

I have an iframe.

I need a cross-browser solution to ensure that only the vertical scrollbar is visible, regardless of the width of the iframe's contents.

My solution already has a dependency on jQuery, so if this is not possible with only CSS I am open to jQuery solutions.

How can I do this?

like image 838
smartcaveman Avatar asked Apr 07 '11 18:04

smartcaveman


1 Answers

this works for me (even on safari too):

<iframe src="http://url/file.html" frameborder="0" style="overflow-y:scroll !important; overflow-x:hidden !important; overflow:hidden;height:100%;width:100%;" scrolling="yes"></iframe>

Or you can do this too:

CSS

iframe {
    overflow-y:scroll !important;
    overflow-x:hidden !important;
    overflow:hidden;
    height:100%; /* optional */
    width:100%; /* optional */
    border:none; /* optional */
}

HTML

<iframe src="http://url/file.html" scrolling="yes"></iframe>

*src (http://url/file.html), needs to point to a valid URL and HTML file.

like image 197
null Avatar answered Oct 13 '22 04:10

null