父元素:overflow:hidden
子元素:overflow:scroll
父元素滚动条宽度设置为0
.father ::-webkit-scrollbar{
width: 0px;
}
代码示例:
.father{
width: 200px;
overflow: hidden;
}
.father ::-webkit-scrollbar{
width: 0px;
}
.son {
margin-top: 8px;
overflow-x: scroll;
white-space: nowrap;
}
.son span {
display: inline-block;
width: 40px;
height: 40px;
line-height: 40px;
text-align: center;
font-size: 16px;
color: #333333;
background: rgba(219, 231, 235, 0.2);
border-radius: 2px;
margin-right: 8px;
}