老师。请检查一下作业!
来源:4-1 定位和边距的区别以及弹出层的简单实例
好狗边上飘314
2019-09-28 09:51:45
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title></title>
<style type="text/css">
*{margin:0;
padding:0;}
html,body{width:100%;
height:100%;
}
.testone{width:100%;
height:2569px;
background:url("imooc.png") center top no-repeat;
}
.testtwo{width:100%;
height:100%;
background:url("https://www.imooc.com/static/img/course/logo-course.png") no-repeat;
position:fixed;
left:0;
top:0;
}
.testthree{width:377px;
height:374px;
background:url(denglu.png) no-repeat;
position:fixed;
left:50%;
top:50%;
margin-left:-188.5px;
margin-top:-187px;
/* top:0;
right:0;
bottom:0;
left:0;
margin:auto auto;
*/
}
</style>
</head>
<body>
<div class="testone"></div>
<div class="testtwo"></div>
<div class="testthree"></div>
</body>
</html>老师帮忙检查一下作业,对于视频讲到的遮罩问题不是很理解,自己随便copy了张图!
1回答
同学你好,因为同学没有提供图片,老师这边使用的是自己的。效果实现的是可以的。
老师添加遮罩的原因是防止用户点击到其他地方(只能点击关于登录的这个地方),遮罩的宽度和高度都是100%,用户就点不到其他地方了。提高了用户的使用体验
如果帮助到了你,欢迎采纳 ~祝学习愉快~
相似问题