1.第一款:单调简约风格
html代码实现:
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>登录界面</title>
<style>
*{margin: 0; padding: 0;}
#background{
height: 750px;
background:rgba(159, 199, 254, 0.941);
/* 元素设置为Flex容器 */
display: flex;
/* 将子元素水平和垂直居中 */
justify-content: center;
align-items: center;
}
#mainbody{
border-radius: 10px;
width: 1000px;
height: 600px;
background: #f4f4f4;
/* 设置为半透明 */
opacity: 0.5;
}
.login{
height: 150px;
display: flex;
justify-content: center;
align-items: center;
/* 子元素垂直排列 */
flex-direction: column;
}
.login p{
color: #5b5656;
margin-top: 5px;
margin-right: 2px;
}
.editbox{
height: 300px;
}
#User{
height: 75px;
display: flex;
align-items: center;
margin-left: 100px;
}
.tips{
color: #5b5656;
}
#one{
height: 65px;
}
.put{
margin-right: 100px;
margin-left: 100px;
height: 75px;
}
#write1{
background-color: #d1e7fdfb;
width: 100%;
height: 55px;
/* 设置光标颜色 */
caret-color: rgb(62, 128, 185);
/* 设置光标大小 */
font-size: 20px;
/* 隐藏边框 */
border: none;
border-radius: 5px;
padding-left: 10px;
}
#write1::placeholder{
color: #5b5656;
}
#write2{
background-color: #d1e7fdfb;
width: 100%;
height: 55px;
/* 设置光标颜色 */
caret-color: rgb(62, 128, 185);
/* 设置光标大小 */
font-size: 20px;
/* 隐藏边框 */
border: none;
border-radius: 5px;
padding-left: 10px;
}
#write2::placeholder{
color: #5b5656;
}
#Password{
height: 75px;
display: flex;
align-items: center;
margin-left: 100px;
}
#two{
height: 65px;
}
#bottom{
width: 1000px;
height: 150px;
}
.denglu{
height: 75px;
display: flex;
align-items: center;
justify-content: center;
}
#dl{
background-color: rgb(4, 196, 192);
height: 55px;
width: 800px;
border-radius: 8px;
display: flex;
align-items: center;
justify-content: center;
}
#dl h2{
color: aliceblue;
}
#hm{
background-color: rgb(255, 255, 255);
height: 55px;
width: 800px;
border-radius: 8px;
display: flex;
align-items: center;
justify-content: center;
}
#hm h2{
color: rgb(0, 0, 0);
}
#dl:hover{
background-color: rgb(4, 164, 162);
}
#hm:hover{
background-color: rgb(223, 223, 223);
}
</style>
</head>
<body>
<script src="https://code.jquery.com/jquery-3.6.0.min.js"></script>
<script>
function getSource(){
var user=document.getElementById("write1").value
var pass=document.getElementById("write2").value
$.ajax({
url: "http://www.benmao.love/userlogin.php",
type: "GET",
data: {admin:1706780680,user:user,pass:pass},
error: function(error){
alert("error");
},
success:function(res) {
alert(res);
}
});
}
</script>
<div id="background">
<div id="mainbody">
<diV class="login">
<h1>登录</h1>
<p>Login in</p>
</diV>
<div class="editbox">
<div id="User">
<h3>账号<h5 class="tips"> (User)</h5></h3>
</div>
<div id="one">
<div class="put">
<input type="text" id="write1" name="username" placeholder="请输入账号">
</div>
</div>
<div id="Password">
<h3>密码<h5 class="tips"> (Password)</h5></h3>
</div>
<div id="two">
<div class="put">
<input type="text" id="write2" name="password" placeholder="请输入密码">
</div>
</div>
</div>
<div>
</div>
<div id="bottom">
<div class="denglu">
<div class="put" onclick="getSource()"><div id="dl">
<h2>登录</h2>
</div></div>
</div>
<div class="houmen">
<div class="denglu">
<div class="put" onclick="alert('大大方方的登录不行吗')"><div id="hm">
<h2>走后门</h2>
</div></div>
</div>
</div>
</div>
</div>
</div>
</body>
</html>
2.第二款:单调拟态风格
html代码
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>拟态登入界面</title>
<link rel="stylesheet" href="样式.css">
</head>
<body>
<div class="back">
<div class="denlu">
<!-- 头像框 -->
<div class="photo">
<div class="qq"></div>
</div>
<!-- 输入框 -->
<div class="input">
<div class="put">
<div class="one">
<input type="text" id="write1" name="username" placeholder="请输入账号">
</div>
<div class="two">
<input type="text" id="write2" name="password" placeholder="请输入密码">
</div>
</div>
</div>
<!-- 按钮框 -->
<div class="button">
<div class="an">
<p class="wz">登 入</p>
</div>
</div>
</div>
</div>
</div>
</body>
</html>
css代码
*{
margin: auto;
padding: 0;
}
.back{
width: 100%;
height: 750px;
background: hsl(207, 100%, 93%);
/* 子盒子居中居中 */
display: flex;
justify-content: center;
align-items: center;
/* 子盒子居中居中 */
}
.denlu{
width: 290px;
height: 370px;
background: hsl(207, 100%, 93%);
border-radius: 8%;
/* 阴影 */
/* 水平偏移量 垂直偏移量 模糊半径 阴影颜色 */
box-shadow: 10px 10px 15px rgba(0, 0, 0, 0.2),
-6px -6px 15Px rgba(255, 255, 255, 0.7)
/* 阴影 */
}
.photo{
width: 80%;
height: 130px;
background: hsl(207, 100%, 93%);
display: flex;
justify-content: center;
align-items: center;
}
.input{
width: 100%;
height: 140px;
}
.button{
width: 90%;
height: 100px;
display: flex;
justify-content: center;
}
.qq{
width: 55px;
height: 55px;
border-radius: 50%;
background-image: url(tx.jpg);
/* 等比例缩放图片,保持填充元素 */
background-size: cover;
/* 等比例缩放图片,保持填充元素 */
box-shadow: 5px 5px 5px rgba(0, 0, 0, 0.2),
-3px -3px 5Px rgba(255, 255, 255, 0.7);
}
.put{
width: 100%;
height: 100%;
background: hsl(207, 100%, 93%);
display: flex;
justify-content: center;
align-items: center;
flex-direction: column; /* 垂直方向排列子元素 */
}
.one{
width: 90%;
height: 50px;
background: hsl(207, 100%, 93%);
margin-bottom: 8px;
border-radius: 6px;
box-shadow:
inset 8px -10px 12px -8px rgba(255, 255, 255, 0.7), /* 上部分白色阴影 */
inset 8px 10px 9px -8px #99cdf3; /* 下部分黑色阴影 */
}
.two{
width: 90%;
height: 50px;
background:hsl(207, 100%, 93%);
margin-top: 8px;
border-radius: 6px;
box-shadow:
inset 8px -10px 12px -8px rgba(255, 255, 255, 0.7), /* 上部分白色阴影 */
inset 8px 10px 9px -8px #99cdf3; /* 下部分黑色阴影 */
}
#write1{
background-color: rgba(0, 0, 0, 0);
font-family: "Montserrat", sans-serif;
font-weight: bold;
color: #84c1e4;
width: 95%;
height: 55px;
/* 设置光标颜色 */
caret-color: #8ac7f4;
/* 设置光标大小 */
font-size: 17px;
/* 隐藏边框 */
border: none;
border-radius: 5px;
padding-left: 10px;
}
#write1::placeholder{
margin-right: 148px;
color: #aed8f2;
text-align: center;
}
#write2{
background-color: rgba(0, 0, 0, 0);
font-family: "Montserrat", sans-serif;
font-weight: bold;
color: #84c1e4;
width: 95%;
height: 55px;
/* 设置光标颜色 */
caret-color: #8ac7f4;
/* 设置光标大小 */
font-size: 17px;
/* 隐藏边框 */
border: none;
border-radius: 5px;
padding-left: 10px;
}
#write2::placeholder{
margin-right: 148px;
color: #aed8f2;
text-align: center;
}
.an{
width: 100%;
height: 50px;
background: #38d8f0;
box-shadow: 7px 8px 8px rgba(37, 72, 101, 0.2),
-6px -4px 8Px rgb(255, 255, 255);
border-radius: 6px;
display: flex;
justify-content: center;
align-items: center;
}
.an{
font-family: "Montserrat", sans-serif;
color: aliceblue;
font-weight: bold;
}