请老师检查一下,关于设置图片之间的距离有疑惑
<!DOCTYPE html> <html> <head> <meta charset="UTF-8"> <title>buju</title> <style type="text/css"> *{margin:0;padding:0;} img{vertical-align:middle;} .main{ height: 360px; width:1080px; position:absolute; top:50%; left:50%; margin-left:-540px; margin-top:-180px; } .heard{ height: 240px; width:1080px; background: #add8e6; overflow:hidden; *zoom:1; } .heard .hleft{ float:left; height:240px; line-height: 240px; /*width:40%;*/ margin-left: 10%; } .heard .hright{ float:right; height:240px; line-height: 240px; /*width:10%; */ margin-right: 10%; } .foot{ height: 120px; width:1080px; background: #ffb6c1; overflow:hidden; *zoom:1; } .foot .fleft{ float: left; height: 120px; line-height:120px; margin-left: 10% } .foot .fmiddle{ float:left; height: 120px; line-height:120px; margin-left:10%; } .foot .fright{ float:right; height: 120px; line-height:120px; margin-right: 10%; } </style> </head> <body> <div class="main"> <div class="heard"> <div class="hleft"><img src="http://img1.sycdn.imooc.com\/climg/58c0f808000129a303600215.jpg" alt="" /></div> <div class="hright"><img src="http://img1.sycdn.imooc.com\/climg/58c0f819000198a703600214.jpg" alt=""></div> </div> <div class="foot"> <div class="fleft"><img src="http://img1.sycdn.imooc.com\/climg/58c0f81d0001fe4402000060.jpg"></div> <div class="fmiddle"><img src="http://img1.sycdn.imooc.com\/climg/58c0f8220001dfce02000060.jpg"></div> <div class="fright"><img src="http://img1.sycdn.imooc.com\/climg/58c0f8780001c74602000060.jpg"></div> </div> </div> </body> </html>
实现图片之间水平的间距,是用margin百分比或者计算固定的margin距离,还是用定位比较好呢,想采用最优方案
0
收起
正在回答
1回答
你好同学 , 图片之间间距相等的效果没有实现 , 建议如下修改:
小图片也要修改间距:
在本练习中 , 建议使用固定宽度更方便一些哦 . 祝学习愉快 ,望采纳
前端小白入门系列课程
- 参与学习 人
- 提交作业 11218 份
- 解答问题 36712 个
从一个不会编程的小白到一个老司机是需要过程的,首先得入门,学习基础知识,然后才能进阶,最后再到精通,本专题是你走进前端世界的不二选择!
了解课程
恭喜解决一个难题,获得1积分~
来为老师/同学的回答评分吧
0 星