Remove iframe horizontal scrollbar

2019-03-15 05:33发布

问题:

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

Anyone please solve my problem. Advance Wishes.

回答1:

In the iframe page itself, add this:

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


回答2:

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

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


回答3:

Here is an IFrame-resize script.

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". :-(



回答4:

The solution is:

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

in tag <body> of page included on iframe

SEE THIS LINK PAGE

Regards by Raffaele.



标签: html iframe