Hide scroll bar, but while still being able to scroll

前端 未结 30 3314
悲哀的现实
悲哀的现实 2020-11-21 04:22

I want to be able to scroll through the whole page, but without the scrollbar being shown.

In Google Chrome it\'s:

::-webkit-scrollbar {
    display:         


        
30条回答
  •  终归单人心
    2020-11-21 04:40

    This works for me cross-browser. However, this doesn't hide native scrollbars on mobile browsers.

    In SCSS

    .hide-native-scrollbar {
      scrollbar-width: none; /* Firefox 64 */
      -ms-overflow-style: none; /* Internet Explorer 11 */
      &::-webkit-scrollbar { /** WebKit */
        display: none;
      }
    }
    

    In CSS

    .hide-native-scrollbar {
      scrollbar-width: none; /* Firefox 64 */
      -ms-overflow-style: none; /* Internet Explorer 11 */
    }
    .hide-native-scrollbar::-webkit-scrollbar { /** WebKit */
      display: none;
    }
    

提交回复
热议问题