效果
html
通用样式
.box{
width: 100vw;
height: 100vh;
background-color: rgb(29, 67, 89);
.content{
.login-wrapper{
h1{
text-align: center;
}
.login-form{
.form-item{
margin: 20px 0;
span{
display: block;//变成块级元素
margin: 5px 20px;
font-weight: 100;
}
.input-item{
width: 100%;
border-radius: 40px;
padding: 20px;
box-sizing: border-box;//不会撑大盒子
font-size: 20px;
&:focus{
outline: none;//去掉点击时周围的虚线框
}
}
}
.login-btn{
width: 100%;
border-radius: 40px;
color: #fff;
border: 0;
font-weight: 100;
margin-top: 10px;
cursor: pointer;
}
}
.divider{
width: 100%;
margin: 20px 0;
text-align: center;
display: flex;
align-items: center;
justify-content: center;
span:nth-child(1){
flex: 1;
}
span:nth-child(3){
flex: 1;
}
.line{
display: inline-block;
max-width: 30%;
width: 30%;
}
.divider-text{
vertical-align: middle;
margin: 0 20px;
line-height: 0;
display: inline-block;
width: 100px;
}
}
.other-login-wrapper{
width: 100%;
display: flex;
justify-content: center;
align-items: center;
}
.other-login-item{
border: 1px solid rgb(214, 222, 228);
padding: 10px;
margin: 10px;
}
}
}
}
大于手机尺寸样式
@media(min-width:767px){
.box{
background-color: rgb(29, 67, 89);
.content{
width: 85vw;
height: 90vh;
background: url(./asset/login_two.jpg) no-repeat;
background-size: 90% 100%;
position: absolute;
// right: 15%;
top: 50%;
left: 50%;
transform: translate(-50%,-50%);
border-radius: 20px;
background-color: #fff;
.login-wrapper{
width: 25vw;
position: absolute;
right: 15%;
top: 50%;
transform: translateY(-50%);
h1{
text-align: center;
font-size: 45px;
color: rgb(81, 100, 115);
margin-bottom: 40px;
}
.login-form{
margin: 10px 0;
.form-item{
span{
color: rgb(81, 100, 115);
}
.input-item{
height: 60px;
border: 1px solid;
}
}
.login-btn{
height: 50px;
background-color: rgb(50, 72, 89);
}
}
.divider{
.line{
border-bottom: 1px solid rgb(214, 222, 228);
}
}
.other-login-item{
border-radius: 20px;
img{
width: 40px;
height: 40px;
}
}
}
}
}
}
手机端样式
@media (max-width:768px){
.box{
width: 100vw;
height: 100vh;
background: url(./asset/login_bg_phone.png) no-repeat;
background-size: 100% 100%;
display: flex;
align-items: flex-start;
justify-content: center;
.login-wrapper{
width: 70%;
height: 60%;
padding-top: 15%;
h1{
font-size: 30px;
color: #fff;
}
.login-form{
.form-item{
margin: 10px 0;
span{
color: rgb(113, 129, 141);
}
}
.login-btn{
height: 40px;
background-color: rgb(235, 95, 93);
color: #fff;
}
}
.other-login-item{
border-radius: 15px;
img{
width: 35px;
height: 35px;
}
}
}
}
}