自定义滚动条样式

::-webkit-scrollbar //滚动条整体部分
::-webkit-scrollbar-button //滚动条两端的按钮
::-webkit-scrollbar-track // 外层轨道
::-webkit-scrollbar-track-piece //内层轨道,滚动条中间部分(除去)
::-webkit-scrollbar-thumb //滚动条里面可以拖动的那个
::-webkit-scrollbar-corner //边角
::-webkit-resizer ///定义右下角拖动块的样式

在这里插入图片描述

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>Document</title>
</head>
<body>
      <div class="bigBox">
          <div class="list1">
              <p style="height:800px;width: 200%">
                默认样式
              </p>
          </div>
          <div class="list2">
                <p style="height:800px;width: 200%">
                内容2<br>
                </p>
          </div>
          <div class="list3">
                <p style="height:800px;width: 200%">
                内容3<br>
                </p>
          </div>
          <div class="list4">
                <p style="height:800px;width: 200%">
                内容4<br>
                </p>
          </div>
      </div>
</body>
<script>
    
</script>
<style>
body,html{
    background: linear-gradient(left,#03a9f4, #f71ab95e); /* 标准的语法 */
    background: -webkit-linear-gradient(left,#03a9f4, #f71ab95e); /* Safari 5.1 - 6.0 */
    background: -o-linear-gradient(left,#03a9f4, #f71ab95e); /* Opera 11.1 - 12.0 */
    background: -moz-linear-gradient(left,#03a9f4, #f71ab95e); /* Firefox 3.6 - 15 */
}
    /* 
    ::-webkit-scrollbar    //滚动条整体部分
    ::-webkit-scrollbar-button   //滚动条两端的按钮
    ::-webkit-scrollbar-track   // 外层轨道
    ::-webkit-scrollbar-track-piece    //内层轨道,滚动条中间部分(除去)
    ::-webkit-scrollbar-thumb //滚动条里面可以拖动的那个
    ::-webkit-scrollbar-corner   //边角
    ::-webkit-resizer   ///定义右下角拖动块的样式
 */
.bigBox{
    width: 100%;
    background: green;
}
.bigBox div{
    width: 10%;
    float: left;
    height: 500px;
    margin-left:12%;
    overflow-y: scroll;
}
.bigBox .list1{
    background: pink
}


.bigBox .list2{
    background: red
}
.list2::-webkit-scrollbar
{
	width: 12px;
	background-color: #000000;
}
.list2::-webkit-scrollbar-thumb
{
	border-radius: 10px;
	background-color: #FFFFFF;
    border-radius: 0;
}
.list2::-webkit-scrollbar-button{
    background: green;
    width: 12px;
    height: 20px;
    color: green;
    content: "▲";
}
.list2::-webkit-resizer{
    background: orange;
}

.list3{
    background: #4F9D9D;
}
.list3::-webkit-resizer{border-radius:.3125rem;background-color:#2f4056}
.list3::-webkit-scrollbar{width:12px;height:12px}
.list3::-webkit-scrollbar-thumb{border-radius:5px;background-color:#0073aa;background-image:-webkit-linear-gradient(45deg,hsla(0,0%,100%,.4) 25%,transparent 25%,transparent 50%,hsla(0,0%,100%,.4) 50%,hsla(0,0%,100%,.4) 75%,transparent 75%,transparent)}

.list4{
    background: 	#E800E8;
}
.list4::-webkit-scrollbar{
    width:12px;
    height:12px
    }
.list4::-webkit-scrollbar-thumb{
    width:12px;
    background: linear-gradient(top,#00EC00,#424200);
    background: -webkit-linear-gradient(top,#00EC00,#424200);
    background: -moz-linear-gradient(top,#00EC00,#424200);
    background: -o-linear-gradient(top,#00EC00,#424200);
    border-radius: 5px;
}

</style>
</html>
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值