css white-space: nowrap 实现横向滚动

2019-03-19  本文已影响0人  麻辣小面瘫

nowrap: 文本不会换行,文本会在在同一行上继续,直到遇到
标签为止。

实现:

<div style="width: 600px; height: 100px;white-space: nowrap; overflow: auto;font-size: 0;">
  <div style="width: 200px; height: 80px;background: #999;display:inline-block;margin-right: 10px;"></div>
  <div style="width: 200px; height: 80px;background: #999;display:inline-block;margin-right: 10px;"></div>
  <div style="width: 200px; height: 80px;background: #999;display:inline-block;margin-right: 10px;"></div>
  <div style="width: 200px; height: 80px;background: #999;display:inline-block;margin-right: 10px;"></div>
</div>

上一篇 下一篇

猜你喜欢

热点阅读