console
<div class="scrollbar-container">
<div class="content"></div>
</div>
<p>直接改变</p>
<div class="scrollbar-container2">
<div class="content"></div>
</div>
.scrollbar-container {
width: 300px;
height: 200px;
overflow: auto;
border: 1px solid #ccc;
}
.content {
width: 500px;
height: 1000px;
}
::-webkit-scrollbar {
height: 12px !important;
width: 12px !important;
}
::-webkit-scrollbar-corner {
background-color: transparent;
}
::-webkit-scrollbar-thumb {
border-radius: 5px;
border-style: dashed;
background-color: rgba(157, 165, 183, 0.4);
border-color: transparent;
border-width: 2px;
background-clip: padding-box;
}
::-webkit-scrollbar-thumb:hover {
background: rgba(157, 165, 183, 0.7)
}
.scrollbar-container2 {
width: 300px;
height: 200px;
overflow: auto;
border: 1px solid #ccc;
}
.scrollbar-container2::-webkit-scrollbar {
width: 8px;
height: 8px;
}
.scrollbar-container2:hover::-webkit-scrollbar {
width: 14px;
height: 14px;
}
.scrollbar-container2::-webkit-scrollbar-thumb {
cursor: pointer;
background-color: #ccc;
border-radius: 6px;
transition: background-color 0.3s, border-radius 0.3s;
}
.scrollbar-container2:hover::-webkit-scrollbar-thumb {
background-color: red;
border-radius: 50px;
}