HTML5 : Iframe No scrolling?

前端 未结 1 391
盖世英雄少女心
盖世英雄少女心 2020-12-01 13:43

When it comes to HTML5, scrolling attribute is no longer supported - but I still need to remove the scroll bars - how to do that?

1条回答
  •  感动是毒
    2020-12-01 14:27

    In HTML5 there is no scrolling attribute because "its function is better handled by CSS" see http://www.w3.org/TR/html5-diff/ for other changes. Well and the CSS solution:

    CSS solution:

    HTML4's scrolling="no" is kind of an alias of the CSS's overflow: hidden, to do so it is important to set size attributes width/height:

    iframe.noScrolling{
      width: 250px; /*or any other size*/
      height: 300px; /*or any other size*/
      overflow: hidden;
    }
    

    Add this class to your iframe and you're done:

    
    

    ! IMPORTANT NOTE ! : overflow: hidden for