时间:2021-07-01 10:21:17 帮助过:23人阅读
如何在固定大小的DIV层插入N多个图片,使其一行排列,超出层宽时出现滑动条?
原以为利用overflow属性可以实现,但是测试失败。后来利用div层叠实现了效果。
HTML代码:
1:
2:
3:
4:
5:
6:
7:
8:9:10:11:12:
13:
14:
css控制样式:
1: .div{
2: width:400px;
3: height:200px;
4: overflow-y:hidden; /*只出现水平滚动条*/
5: position: absolute;
6: }
7: .div1{
8: position:absolute;
9: z-index:1;
10: }
11: .div2{
12: position:absolute;
13: z-index:5;
14: left:200px;
15: top:0px
16: }
17: .div3{
18: position:absolute;
19: z-index:10;
20: left:400px;
21: top:0px
22: }
效果:
来源:http://www.ido321.com/666.html