我body和.opacity宽高都设成了100%,照理说都是视窗的宽高
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 | 可用f12查看div范围的时候,opacity和body虽然都是一样的width和height,但范围明显不一样, <!DOCTYPE html> < html > < head > < meta charset = "UTF-8" > < title >Document</ title > < style type = "text/css" > *{padding:0; margin:0;} html,body{ width:100%; height: 100%; } .con{ width:100%; height:4000px; background:url(mooc.png) center top no-repeat; } .opacity{ width:100%; height:100%; opacity:0.5; background:black; position:fixed; top:0; } .login{ width:360px; height:360px; background:url(login.png); position:fixed; top:50%; left:50%; margin-left:-180px; margin-top:-180px; z-index:1; } </ style > </ head > < body > < div class = "con" > </ div > < div class = "login" > </ div > < div class = "opacity" > </ div > </ body > </ html > |
39
收起
正在回答 回答被采纳积分+1
2回答
前端小白入门系列课程
- 参与学习 人
- 提交作业 11218 份
- 解答问题 36712 个
从一个不会编程的小白到一个老司机是需要过程的,首先得入门,学习基础知识,然后才能进阶,最后再到精通,本专题是你走进前端世界的不二选择!
了解课程
恭喜解决一个难题,获得1积分~
来为老师/同学的回答评分吧
0 星