您好,欢迎来到三六零分类信息网!老站,搜索引擎当天收录,欢迎发信息

css怎么让图片横着排列

2024/10/23 15:35:56发布19次查看
css让图片横着排列的方法:首先创建一个div来包裹所有的图片;然后隐藏外层div在纵向的滚动条,将横向滚动条设置为自动;最后设置外层div的white-space属性值为nowrap即可。
本教程操作环境:windows7系统、html5&&css3版本、dell g3电脑。
推荐:css视频教程
css让图片横着排列
下面直接通过代码示例来介绍一下:
<!doctype html><html><head> <meta charset="utf-8"> <title></title> <style> .wrap{ height: 130px; overflow-x: auto; overflow-y: hidden; white-space: nowrap; } .b{ width: 200px; height: 100px; } </style></head><body> <div class="wrap"> <img src="1.jpg" alt="" class="b"> <img src="1.jpg" alt="" class="b"> <img src="1.jpg" alt="" class="b"> <img src="1.jpg" alt="" class="b"> <img src="1.jpg" alt="" class="b"> <img src="1.jpg" alt="" class="b"> <img src="1.jpg" alt="" class="b"> <img src="1.jpg" alt="" class="b"> <img src="1.jpg" alt="" class="b"> <img src="1.jpg" alt="" class="b"> <img src="1.jpg" alt="" class="b"> <img src="1.jpg" alt="" class="b"> <img src="1.jpg" alt="" class="b"> </div></body></html>
效果图:
注意,img标签不能左浮动,外层容器必须加不换行。
以上就是css怎么让图片横着排列的详细内容。
该用户其它信息

VIP推荐

免费发布信息,免费发布B2B信息网站平台 - 三六零分类信息网 沪ICP备09012988号-2
企业名录 Product