HTML iframe - disable scroll

2019-01-03 00:02发布

I have following iframe in my site:

<iframe src="<<URL>>" height="800" width="800" sandbox="allow-same-origin allow-scripts allow-forms" scrolling="no" style="overflow: hidden"></iframe>

And it has scrolling bars.
How to get rid of them?

标签: html css iframe
10条回答
手持菜刀,她持情操
2楼-- · 2019-01-03 00:48

I solved the same issue with this css:

    pointer-events:none;
查看更多
ら.Afraid
3楼-- · 2019-01-03 00:48

It seems to work using

html, body { overflow: hidden; }

inside the IFrame

edit: Of course this is only working, if you have access to the Iframe's content (which I have in my case)

查看更多
家丑人穷心不美
4楼-- · 2019-01-03 00:50

Add this styles..for your iframe tag..

overflow-x:hidden;
overflow-y:hidden;
查看更多
女痞
5楼-- · 2019-01-03 00:52

Since the "overflow: hidden;" property does not properly work on the iFrame itself, but seems to give results when applied to the body of the page inside the iFrame, I tried this :

iframe body { overflow:hidden; }

Which surprisingly did work with Firefox, removing those annoying scrollbars.

In Safari though, a weird 2-pixels-wide transparent line has appeared on the right side of the iframe, between its contents and its border. Strange.

查看更多
登录 后发表回答