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

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>

©著作权归作者所有,转载或内容合作请联系作者
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

推荐阅读更多精彩内容