[整理] css 改变滚动条样式-基于谷歌和火狐

谷歌

        .test-1::-webkit-scrollbar {
            /*滚动条整体样式*/
            width: 10px;
            /*高宽分别对应横竖滚动条的尺寸*/
            height: 1px;
        }

        .test-1::-webkit-scrollbar-thumb {
            /*滚动条里面小方块*/
            
            border-radius: 10px;
            background-color: skyblue;
            background-image: -webkit-linear-gradient(45deg,
                    rgba(255, 255, 255, 0.2) 25%,
                    transparent 25%,
                    transparent 50%,
                    rgba(255, 255, 255, 0.2) 50%,
                    rgba(255, 255, 255, 0.2) 75%,
                    transparent 75%,
                    transparent);
        }

        .test-1::-webkit-scrollbar-track {
            /*滚动条里面轨道*/
            box-shadow: inset 0 0 5px rgba(0, 0, 0, 0.2);
            background: #ededed;
        }

火狐

            scrollbar-color: skyblue #ededed;
            scrollbar-width: thin;
posted @ 2021-08-22 18:36  哆啦梦乐园  阅读(123)  评论(0编辑  收藏  举报