css sets the scroll bar style, slider height and style, etc.

1. Vertical scrolling

1. Rendering

insert image description here

2. Code implementation

<div class="box">
  <p v-for="item in 100" :key="item">{
   
   {item}}</p>
</div>
.box {
    
    
  height: 100px;
  overflow: auto;
  border: 1px solid red;
}
// 滚动条
.box::-webkit-scrollbar {
    
    
  /*滚动条整体样式*/
  width: 10px; /*高宽分别对应横竖滚动条的尺寸*/
  height: 1px;
}
.box::-webkit-scrollbar-thumb {
    
    
  /*滚动条里面小方块*/
  border-radius: 10px;
  height: 20px;
  -webkit-box-shadow: inset 0 0 5px rgba(0, 0, 0, 0.2);
  // background: #E5E5E5;
  background: red;
}
.box::-webkit-scrollbar-track {
    
    
  /*滚动条里面轨道*/
  -webkit-box-shadow: inset 0 0 5px rgba(0, 0, 0, 0.2);
  border-radius: 10px;
  background: #ffffff;
}

Guess you like

Origin blog.csdn.net/DarlingYL/article/details/130929115