html代码
<div class="box">
<div class="content"></div>
</div>
css代码
.box {
height: 200px;
width: 500px;
background: pink;
overflow: auto;
}
.content {
height: 400px;
background: green;
}
.box::-webkit-scrollbar {
width: 4px;
height: 4px;
}
.box::-webkit-scrollbar-track {
background-color: #f1f1f1;
-webkit-border-radius: 2em;
-moz-border-radius: 2em;
border-radius: 2em;
}
.box::-webkit-scrollbar-thumb {
background-color: #c1c1c1;
-webkit-border-radius: 2em;
-moz-border-radius: 2em;
border-radius: 2em;
}