Web page custom scroll bar style

Web page custom scroll bar style


The basic code is as follows

<div class="content">
	<div class="contentHeight"></div>
</div>
.content {
    
    
	width: 300px;
	height: 300px;
	overflow: hidden;
	overflow-y: scroll;
	background-color: #00FFFF;
	border: 1px solid #000;
}
.contentHeight {
    
    
	width: 500px;
	height: 500px;
}

::-webkit-scrollbar The whole part of the scroll bar, the width can be set
::-webkit-scrollbar-button Buttons at both ends of the scrollbar
::-webkit-scrollbar-track outer track
::-webkit-scrollbar-track-piece inner scroll bar
::-webkit-scrollbar-thumb scroll bar
::-webkit-scrollbar-corner corner
::-webkit-resizer defines the style of the drag block in the lower right corner
.content::-webkit-scrollbar {
    
    
	/*滚动条整体样式*/
	/*高宽分别对应横竖滚动条的尺寸*/
	height: 50px;
	width: 5px;
}
.content::-webkit-scrollbar-thumb {
    
    
	/*滚动条里面小方块*/
	border-radius: 5px;
	-webkit-box-shadow: inset 0 0 5px rgba(0, 0, 0, 0.2);
	background: #535353;
}

.content::-webkit-scrollbar-track {
    
    
	/*滚动条里面轨道*/
	-webkit-box-shadow: inset 0 0 5px rgba(0, 0, 0, 0.2);
	border-radius: 5px;
	background: #fff;
}
.content::-webkit-scrollbar-button{
    
    
	width: 6px;
	height: 6px;
	background-color: red;
}

insert image description here

Guess you like

Origin blog.csdn.net/qq_41880073/article/details/123121702