简体   繁体   English

iframe滚动溢出隐藏在css中不起作用

[英]Iframe scrolling overflow hidden not working in css

Here is the iframe 这是iframe

<iframe class="iframe_style" id="iframeid" src="#" height="100%" width="100%" ></iframe>

I'm using CSS as overflow: hidden, but still I'm getting scrolling.. 我正在使用CSS作为溢出:隐藏,但是仍然在滚动。

.iframe_style{
border: 3px solid red;
overflow: hidden;
}

JSFIDDLE JSFIDDLE

Any help on this? 有什么帮助吗?

As I can see in your fiddle you set iframe overflow to hidden which will work for Iframe contents 正如我在您的提琴中看到的那样,您将iframe overflow设置为hidden ,这将适用于iframe内容

If you want to make it for body , just add 如果要使其成为body ,只需添加

body{
    overflow:hidden;
}

JSFIDDLE JSFIDDLE

Add display: block to the iframe. 添加display: block到iframe。

.iframe_style{
    border: 3px solid red;
    display: block;
}

Don't forget to account for the border that you have added. 不要忘记考虑您添加的边框。 Subtract the border size from the width and height using jQuery. 使用jQuery从宽度和高度中减去边框大小。

var window_height = $(window).height() - 6;
var window_width = $(window).width() - 6;

JSFiddle: http://jsfiddle.net/Lxjy4ae6/50/ JSFiddle: http : //jsfiddle.net/Lxjy4ae6/50/

body, html { 
    overflow: hidden;
}

Should do the trick. 应该做到的。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM