<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Document</title>
<style>
.box{
width: 400px;
height: 200px;
overflow: auto;
}
.content{
width: 600px;
height: 400px;
}
/* ::-webkit-scrollbar 滚动条整体部分 */
.box::-webkit-scrollbar{
width: 10px;
height: 10px;
background-color: #f5f5f5;
}
/* ::-webkit-scrollbar-button 滚动条俩端的按钮 */
/* ::-webkit-scrollbar-track 外层轨道 */
.box::-webkit-scrollbar-track{
-webkit-box-shadow: inset 0 0 6px rgba(0,0,0,.3);
border-radius: 10px;
background-color: #f5f5f5;
}
/* ::-webkit-scrollbar-track-piece 内层轨道,出去滚动条中间部分 */
/* ::-webkit-slider-thumb 拖动块 */
.box::-webkit-scrollbar-thumb{
border-radius: 10px;
-webkit-box-shadow: inset 0 0 6px rgba(0,0,0.3);
background-color: #d5d5d5;
}
/* ::-webkit-scrollbar-corner 边角 */
/* ::-webkit-resizer 右下角拖动块 */
</style>
</head>
<body>
<div class="box">
<div class="content"></div>
</div>
<script>
</script>
</body>
</html>
效果图