为什么给head设置定位为fixed后,会覆盖下一个div的内容呢?
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 | <!DOCTYPE html> < html > < head > < title >2-3编程练习</ title > < meta charset = "utf-8" > < style type = "text/css" > *{ margin: 0; padding: 0; color: #fff; font-family: "微软雅黑"; } a{ text-decoration:none; } .head{ width: 100%; height: 100px; margin: 0 auto; background-color: #000; position: fixed; top:0; } .logo{ height: 100px; float: left; } .dh{ float: right; height: 100px; margin: 0 auto; line-height: 100px; } .content{ width: 100%; height: auto; } .content img{ width: 100%; } .foot{ width: 100%; height: 50px; background-color: #000; text-align: center; line-height: 50px; position: fixed; left: 0; bottom: 0; } </ style > </ head > < body > < div class = "head" > < div class = "logo" >< a href = "#" >< img src = "http://img1.sycdn.imooc.com/climg//58c0d2d900016ce303000100.png" ></ a ></ div > < div class = "dh" > < a href = "#" >< span >课程</ span ></ a > < a href = "#" >< span >职业路径</ span ></ a > < a href = "#" >< span >实战</ span ></ a > < a href = "#" >< span >猿问</ span ></ a > < a href = "#" >< span >手记</ span ></ a > </ div > </ div > < div class = "content" >< a href = "#" >< img src = "http://img1.sycdn.imooc.com/climg//58c0eda50001e12416000480.jpg" alt = "加载失败" ></ a ></ div > < div class = "content" >< a href = "#" >< img src = "http://img1.sycdn.imooc.com/climg//58c0edb80001c9f216000480.jpg" alt = "加载失败" ></ a ></ div > < div class = "content" >< a href = "#" >< img src = "http://img1.sycdn.imooc.com/climg//58c0edc9000100d516000480.jpg" alt = "加载失败" ></ a ></ div > < div class = "foot" > < a href = "#" >< span >网站首页</ span ></ a > < a href = "#" >< span >企业合作</ span ></ a > < a href = "#" >< span >人才招聘</ span ></ a > < a href = "#" >< span >联系我们</ span ></ a > < a href = "#" >< span >常见问题</ span ></ a > < a href = "#" >< span >友情链接</ span ></ a > </ div > </ body > </ html > |
26
收起
正在回答 回答被采纳积分+1
4回答
前端小白入门系列课程
- 参与学习 人
- 提交作业 11218 份
- 解答问题 36712 个
从一个不会编程的小白到一个老司机是需要过程的,首先得入门,学习基础知识,然后才能进阶,最后再到精通,本专题是你走进前端世界的不二选择!
了解课程
恭喜解决一个难题,获得1积分~
来为老师/同学的回答评分吧