关于垂直滚动条样式优化

效果1.在这里插入图片描述
代码:

.on-live {
    width           : 100%;
    background-color: #fff;
    height          : 360px;
    margin: 23px 0 20px 0;
    overflow-y: auto;
    &::-webkit-scrollbar {
        overflow: visible;
        width: 13px;
    }
    
     /*定义滚动条滑块*/
    &::-webkit-scrollbar-thumb {
        background-color: #92BEFF;
        min-height: 15px;
    }
     /*定义滚动条的轨道颜色、内阴影及圆角*/
     &::-webkit-scrollbar-track{ 
          background-color: #EFF6FF;        
        }
        
             /*定义两端按钮的样式*/
    &::-webkit-scrollbar-button:vertical:start {
        background-color:#EFF6FF; 
        background-image : url("../../../../../ydjy/liveshow-icon.png");
        width            : 11px;
        height           : 11px;
        display          : inline-block;
        background-repeat: no-repeat;
        background-position: -105px -15px;
    }
    &::-webkit-scrollbar-button:vertical:end {
        background-color:#EFF6FF; 
        background-image : url("../../../../../ydjy/liveshow-icon.png");
        width            : 11px;
        height           : 11px;
        display          : inline-block;
        background-repeat: no-repeat;
        background-position: -105px -74px;
    }
}

效果2:
在这里插入图片描述
代码:

//mixin方法,可多处使用
@mixin scrollbar($width, $border-radius) {
  overflow-y: auto;

  &::-webkit-scrollbar {
    width: $width;
  }

  &::-webkit-scrollbar-thumb {
    border-radius: $border-radius;
    box-shadow: inset 0 0 5px rgba(0, 0, 0, 0.2);
    background: #B9BAC9;
  }

  &::-webkit-scrollbar-track {
    box-shadow: unset;
    background: #5E5D6E;
    border-radius: $border-radius;
  }

  @media screen and (min--moz-device-pixel-ratio:0) {
    scrollbar-width: thin;
  }
}
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值