发表于: 2018-12-27 20:23:53
1 804
今天完成的事情:
了解了backgroun-image的使用
学会了如何用filter来使图片模糊
学会了如何使用-webkit-mask给图片加上一层颜色膜
完成了任务五的一部分,效果图如下:
html代码如下:
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<link rel="stylesheet" href="task5.css">
<title>任务五</title>
</head>
<body>
<header class="nav">
<div class="return"><img src="150% 返回.png" alt="返回"></div>
<div class="title">个人主页</div>
</header>
<main>
<div class="box">
<div class="backgrund"></div>
<div class="avatar"><img src="矢量智能对象.png"></div>
<span class="information">徐士林 55岁</span>
<span class="address"><img src="Shape 4.png"> 京城 · 四方 · 报纸林</span>
</div>
</main>
</body>
</html>
css代码如下:
*{
padding: 0;
margin: 0;
}
body{
font-size: 16px;
}
.nav{
width: 100%;
height: 43px;
background-color: #5fc0cd;
position: relative;
}
.return img{
float: left;
width: 11px;
height: 18.5px;
margin-left: 17px;
margin-top: 13px;
}
.title{
position: absolute;
top: 50%;
left: 50%;
transform: translate(-50%,-50%);
font-size: 18px;
color: #ffffff;
font-family: "Adobe 黑体 Std";
}
.box{
position: relative;
}
.backgrund{
position: absolute;
background-image: url(../img/38a17cec12b0df5f8a4188382ba0e279e7c6e6def0df-X2hc7H.png);
background-size: 100% 100%;
background-repeat: no-repeat;
width: 100%;
height: 163px;
filter: blur(3px);
-webkit-mask: -webkit-linear-gradient(rgb(0, 0, 0),rgb(0, 0, 0),rgb(0, 0, 0),rgb(0, 0, 0));
}
.avatar{
position: absolute;
display:inline-block;
height: 85px;
width: 85px;
background-color: white;
border-radius: 50%;
text-align: center;
overflow: hidden;
margin-left: 15px;
margin-top: 40px;
}
.avatar img{
width: 57px;
height: 78.5px;
margin-top: 8.5px;
}
.information{
position: absolute;
color: white;
font-size: 18px;
margin-left: 120px;
margin-top: 58px;
}
.address{
position: absolute;
font-size: 12px;
color: white;
margin-left: 120px;
margin-top: 87px;
}
.address img{
width: 8px;
height: 11.5px;
}
明天计划的事情:
继续做任务五
看任务需求资料
遇到的问题:(遇到什么困难,怎么解决的)
对相对定位和绝对定位的不理解导致无法实现要求
绝对相对路径后无法显示图片
无法实现图片模糊内容清晰的需求、
收获:(通过今天的学习,学到了什么知识)
同今天完成的事情
评论