Prevent “overscrolling” of web page

前端 未结 8 2420
星月不相逢
星月不相逢 2020-11-28 01:23

In Chrome for Mac, one can \"overscroll\" a page (for lack of a better word), as shown in the screenshot below, to see \"what\'s behind\", similar to the iPad or iPhone.

8条回答
  •  南笙
    南笙 (楼主)
    2020-11-28 02:15

    position: absolute works for me. I've tested on Chrome 50.0.2661.75 (64-bit) and OSX.

    body {
      overflow: hidden;
    }
    
    // position is important
    #element {
      position: absolute;
      top: 0;
      right: 0;
      bottom: 0;
      left: 0;
      overflow: auto;
    }
    

提交回复
热议问题