首页 文章详情
Div横向排列和出现横向滚动条
约 1 分钟阅读
出现横向滚动条
核心思路是使用white-space
这个属性防止父容器内容换行,例子如下:
<ul>
<li></li>
<li></li>
<li></li>
<li></li>
<li></li>
</ul>
<style>
ul{
width: 100%;
overflow-x: scroll;
overflow-y: hidden;
white-space: nowrap;
}
ul li{
display:inline-block;
box-sizing: border-box;
}
</style>