定位作业,写的不好,总感觉居中有别的办法
html
<div class="zhezhao"></div>
<div class="login">
<div class="name">
<label for="name">姓名</label>
<input type="text" id="name">
</div>
<div class="address">
<label for="address">地址</label>
<input type="text" id="address">
</div>
<div class="but">
<button>提交</button>
</div>
</div>
css
body{
background: url("../img/2018.png");
background-size: cover;
}
.zhezhao{
position: absolute;
left: 0;
top:0;
width: 100%;
height: 100%;
background: black;
opacity: 0.7;
}
.login{
position: absolute;
left: 50%;
top: 50%;
margin-top: -194px;
margin-left: -175px;
width: 300px;
height: 300px;
background: #FFFFFF;
}
.name,.address{
width: 250px;
line-height: 60px;
padding-left: 25px;
}
.name label,.address label{
width: 50px;
}
.name input,.address input{
border: chartreuse 1px solid;
width: 200px;
}
button{
width: 150px;
height: 30px;
margin-left:75px;
}