方法一:不支持IE和火狐,移动端和谷歌浏览器没问题,只需要css即可设置
body{height:2000px;background:gray;} ::-webkit-srollbar-track-piece{background:none;-webkit-border-radius:0} ::-webkit-scrollbar{width:8px;height:8px} ::-webkit-scrollbar-thumb:vertical{height:50px;background-color:#bbbbbb;-webkit-border-radius:4px;outline:0px solid #ffffff;ouline-offset:-2px;border:2px solid #ffffff} ::-webkit-scrollbar-thumb:hover{height:50px;background-color:#999999;-webkit-border-radius:4px} ::-webkit-scrollbar-thumb:horizontal{width:50px;background-color:#bbbbbb;-webkit-border-radius:4px;outline:0px solid #ffffff;ouline-offset:-2px;border:2px solid #ffffff}
方法二:标签配合css实现,这种方法相对麻烦,但是兼容性好