老师两个问题,第一个:我这个实现出来的效果为啥第三张图片显现不出来?第二个:我这个代码还能在简洁吗?
<!DOCTYPE html> <html> <head> <meta charset="UTF-8"> <title></title> <style type="text/css"> /*此处写代码*/ *{margin:0;padding:0; font-family:"微软雅黑"; color:#fff; margin:0 auto; } .head{width:100%; height:100px; background:#000 url(http://img1.sycdn.imooc.com/climg//58c0d2d900016ce303000100.png) no-repeat; line-height:100px; position:fixed; } .list1 li{ margin-right:40px; list-style:none; display:inline-block; float:right; } .content{ width:100%; height:100%; padding-top:100px; } .con1{ width:100%; height:480px; background:url(http://img1.sycdn.imooc.com/climg//58c0eda50001e12416000480.jpg) no-repeat; } .con2{ width:100%; height:480px; background:url(http://img1.sycdn.imooc.com/climg//58c0edb80001c9f216000480.jpg) no-repeat; } .con3{ width:100%; height:480px; background:url(http://img1.sycdn.imooc.com/climg//58c0edc9000100d516000480.jpg) no-repeat; } .foot{ width:100%; height:100px; background:#000; text-align:center; position:fixed; bottom:0px; } .list2 li{ list-style:none; display:inline-block; line-height: 100px; margin:0 15px; } </style> </head> <body> <!-- 此处写代码 --> <div class="container"> <div class="head"> <ul class="list1"> <li>课程</li> <li>职业路径</li> <li>实践</li> <li>猿问</li> <li>手记</li> </ul> </div> <div class="content"> <div class=con1></div> <div class="con2"></div> <div calss="con3"></div> </div> <div class="foot"> <ul class="list2"> <li>网站首页</li> <li>企业合作</li> <li>人才招聘</li> <li>联系我们</li> <li>常见问题</li> <li>友情链接</li> </ul> </div> </div> </body> </html>
14
收起
正在回答
2回答
同学你好,这是由于div的宽度始终是100%,但是高度设置了480px;那么当宽度减小一些(比如说页面缩小的情况),由于宽度不变,那么高度会减小。
可以参考如下修改:
如果我的回答帮到了你,欢迎采纳,祝学习愉快~
恭喜解决一个难题,获得1积分~
来为老师/同学的回答评分吧
0 星