先看一下最终的效果图吧:
父盒子:横向超出滚动:overflow-y: scroll;
并且设置高度例:height: calc(100% - 36px);
.container {
overflow-y: scroll;
height: calc(100% - 36px);
}
自定义滚动条样式
.container::-webkit-scrollbar {
width: 8px;
height: 8px;
}
::-webkit-scrollbar-button {
display: none;
}
::-webkit-scrollbar-track {
background-color: rgba(70, 166, 255, 0.1);
display: none;
}
::-webkit-scrollbar-thumb {
background-color: rgba(70, 166, 255, 0.4);
border: 2px solid transparent;
border-radius: 6px;
background-clip: padding-box;
}
::-webkit-scrollbar-thumb:hover {
background-color: rgba(0, 0, 0, 0.5);
}