老师帮忙检查下代码 顺便还有个问题,底部导航设置浮动后就不能水平居中显示了吗
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 | <!DOCTYPE html> < html > < head > < meta charset = "UTF-8" > < title ></ title > < style type = "text/css" > /*此处写代码*/ *{ margin:0; padding:0; list-style:none; } .header{ width:100%; height:80px; margin:0 auto; background-color:black; overflow:hidden; position: fixed; } .logo{ width:300px; height:80px; background:url(http://img1.sycdn.imooc.com/climg//58c0d2d900016ce303000100.png) 0 center no-repeat; float:left; } .nav{ float:right; } .nav li{ float:left; line-height:80px; padding:0 30px; } .nav li a{ color:#fff; text-decoration:none; } .banner{ padding-top: 80px; padding-bottom:80px; } img{ width: 100%; height: 300px; /* display: block; */ vertical-align: middle; } .footer{ width:100%; height:80px; margin:0 auto; background-color:black; overflow: hidden; position: fixed; bottom: 0; } .footer-nav{ line-height: 80px; text-align: center; } .footer-nav li{ display: inline-block; padding:0 30px; } .footer-nav li a{ color:#fff; text-decoration: none; } </ style > </ head > < body > <!-- 此处写代码 --> <!-- 此处写代码 --> < div class = "container" > < div class = "header" > < a href = "#" > < div class = "logo" ></ div > </ a > < ul class = "nav" > < li >< a href = "#" >课程</ a ></ li > < li >< a href = "#" >职业路径</ a ></ li > < li >< a href = "#" >实战</ a ></ li > < li >< a href = "#" >猿问</ a ></ li > < li >< a href = "#" >手记</ a ></ li > </ ul > </ div > < div class = "banner" > < img src = "http://img1.sycdn.imooc.com/climg//58c0eda50001e12416000480.jpg" alt = "" > < img src = "http://img1.sycdn.imooc.com/climg//58c0edb80001c9f216000480.jpg" alt = "" > < img src = "http://img1.sycdn.imooc.com/climg//58c0edc9000100d516000480.jpg" alt = "" > </ div > < div class = "footer" > < ul class = "footer-nav" > < li >< a href = "#" >网站首页</ a ></ li > < li >< a href = "#" >企业合作</ a ></ li > < li >< a href = "#" >人才培训</ a ></ li > < li >< a href = "#" >联系我们</ a ></ li > < li >< a href = "#" >友情链接</ a ></ li > </ ul > </ div > </ div > </ body > </ html > |
0
收起
正在回答
2回答
同学你好。
我给你写了一下例子,你参考一下:
如果帮助到了你,欢迎采纳!
祝学习愉快!
恭喜解决一个难题,获得1积分~
来为老师/同学的回答评分吧