Html 移除 iframe 水平滚动条

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/3448265/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-29 04:03:56  来源:igfitidea点击:

Remove iframe horizontal scrollbar

htmliframe

提问by Shankaralwar

I want to remove the horizontal scrollbar in my iframe. I just need a vertical scrollbar to view the lengthy contents. My code is

我想删除 iframe 中的水平滚动条。我只需要一个垂直滚动条来查看冗长的内容。我的代码是

<iframe height='514' width='790' 
        marginwidth='0' marginheight='0' 
        frameborder='0' 
        overflow-y='scroll' 
        overflow-x='hidden'>
</iframe>

Anyone please solve my problem. Advance Wishes.

任何人都请解决我的问题。提前许愿。

回答by justacoder

In the iframe page itself, add this:

在 iframe 页面本身中,添加以下内容:

body {
    overflow-x:hidden;
    height:100%; //optional, but it can't hurt.
}

回答by jswanson

If you are using a browser that supports CSS3 you could use the overflow-x property.

如果您使用支持 CSS3 的浏览器,则可以使用 overflow-x 属性。

#my-iframe
{
   overflow-x:hidden;
}

回答by Kurkula

Try setting scrolling attribute to "no"

尝试将滚动属性设置为“否”

<iframe scrolling="no" ..............> </iframe>

回答by Tuomas Hietanen

Hereis an IFrame-resize script.

是一个 IFrame-resize 脚本。

However, if you use SSL then there is no way to use a script to communicate between the frame and the main window. It will give an "access denied". :-(

但是,如果您使用 SSL,则无法使用脚本在框架和主窗口之间进行通信。它将给出“拒绝访问”。:-(

回答by user3506118

The solution is:

解决办法是:

style="overflow-x:hidden;
overflow-y:scroll;

in tag <body>of page included on iframe

<body>包含在页面的标签中iframe

SEE THIS LINK PAGE

SEE THIS LINK PAGE

Regards by Raffaele.

拉斐尔的问候。