How to remove iframe's scrollbars?

2020-02-10 15:17发布

问题:

How to remove iframe's scrllbars? In Firefox it's easy, however I found myself unable to achieve this effect to be compatible with all major browsers.

回答1:

CSS

iframe {
   overflow: hidden;
}

And/or use Coin_op's answer, it seems to be better.



回答2:

If the CSS technique isn't working for you, try also adding the property scrolling="no" to the iframe HTML tag.

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


回答3:

on top of Alex's answer, I also had to add the following to remove horizontal toolbars from both FF and Chrome. This was added in the i-frame page, even though it should be possible to add it in the css as well:

    <style>
        iframe::-webkit-scrollbar {  
        display: none;
    }  
    </style>


回答4:

<iframe runat="server" id="_theFrame"  src="url" width="100%" scrolling="no" height="200" frameborder="0" allowtransparency="true" marginwidth="0" marginheight="0" style="display: block; background: none repeat scroll 0% 0% transparent; width: 100%;" />