Disable vertical scroll bar on div overflow: auto

后端 未结 8 1800
别跟我提以往
别跟我提以往 2020-12-23 08:48

Is it possible to allow only a horizontal scroll bar when using overflow:auto (or scroll)?

8条回答
  •  臣服心动
    2020-12-23 09:25

    if you want to disable the scrollbar, but still able to scroll the content of inner DIV, use below code in css,

    .divHideScroll::-webkit-scrollbar {
        width: 0 !important
    }
    .divHideScroll {
        overflow: -moz-scrollbars-none;
    }
    .divHideScroll {
        -ms-overflow-style: none;
    }
    

    divHideScroll is the class name of the target div.

    It will work in all major browser (Chrome, Safari, Mozilla, Opera, and IE)

提交回复
热议问题