看到美丽的页面总是让人心动不已,下面就来看一看如何设计一个美丽的登录页面吧。小编就直接看源代码吧

首先我们需要一个完整的HTML

<!DOCTYPE html>
<html lang="en">
	<head>
		<meta charset="utf-8" >
		<title>登录界面</title>
		<link rel="stylesheet" href="css/login.css"/>
	</head>
	<body>
		<stection>
			<!-- 背景色 -->
			<div class="color"></div>
			<div class="color"></div>
			<div class="color"></div>
			<div class='box'>
				<!-- 背景圆 -->
				<div class="circle" style="--x:0"></div>
				<div class="circle" style="--x:1"></div>
				<div class="circle" style="--x:2"></div>
				<div class="circle" style="--x:3"></div>
				<div class="circle" style="--x:4"></div>
				<!-- 登录框 -->
				<div class='container'>
					<div class="from">
						<h2>登录</h2>
						<form >
							<div class="inputbox">
								<input type="text" placeholder="姓名" />
							</div>
							<div class="inputbox">
								<input type="password" placeholder="密码" />
							</div>
							<div class="inputbox">
								<input type="submit" value="登录" />
							</div>
							<p class="forget">忘记密码?<a href="#">点击这里</a> </p>
							<p class="forget">没有账号?<a href="#">点击注册</a> </p>
						</form>	
					</div>
				</div>
			</div>
		</stection>
	</body>
</html>

css样式部分

*{
	margin: 0;
	padding: 0;
	box-sizing: border-box;
}
/* 垂直居中 */
stection{
	display: flex;
	justify-content: center;
	align-items: center;
	min-height: 100vh;
	position: relative;
	overflow: hidden;
	/* 渐变效果 */
	background: linear-gradient(to bottom,#fif4f9,#dffiff);
}
/* 背景颜色 */
stection .color{
	position: absolute;
	filter: blur(200px);
}
stection .color:nth-child(1){
	top :-350px;
	width: 600px;
	height: 600px;
	background: #ff350d;
}
stection .color:nth-child(2){
	bottom :-150px;
	left: 100px;
	width: 500px;
	height: 500px;
	background: #fffd87;
}
stection .color:nth-child(1){
	bottom :50px;
	right: 100px;
	width: 500px;
	height: 500px;
	background: #00d2ff;
}
.box{
	position: relative;
}
.box .circle{
	position: absolute;
	background: rgba(255,255,255,0.1);
	backdrop-filter: blur(5px);
	box-shadow: 0 25px 45px rgba(0,0,0,0.1);
	border: 1px solid rgba(255,255,255,0.1);
	border-right: 1px solid rgba(255,255,255,0.1);
	border-bottom: 1px solid rgba(255,255,255,0.1);
	filter: hue-rotate(calc(var(--x) * 80deg));
	animation: animate 10s linear infinite ;
	animation-delay: calc(var(--x) *-2s );
}
@keyframes animate{
	0% , 100%{
		transform: translateY(-50px);
	}
	50%{
		transform: translateY(50px);
	}
}
.box .circle:nth-child(1){
	top:-50px;
	right: -60px;
	width: 100px;
	height: 100px;
	
}
.box .circle:nth-child(2){
	top:150px;
	right: -100px;
	width: 120px;
	height: 120px;
	z-index: 2;
	
}
.box .circle:nth-child(3){
	bottom: 50px;
	right: -60px;
	width: 80px;
	height: 80px;
	z-index: 2;
	
}
.box .circle:nth-child(4){
	bottom: -80px;
	left: 100px;
	width: 60px;
	height: 60px;
	z-index: 2;
	
}
.box .circle:nth-child(5){
	bottom: -80px;
	left: 140px;
	width: 60px;
	height: 60px;
	z-index: 2;
	
}
/* 登录框样式 */
.container{
	position: relative;
	width: 400px;
	min-height: 400px;
	background: rgba(255,255,255,0.1);
	display: flex;
	justify-content: center;
	align-items: center;
	backdrop-filter: blur(5px);
	box-shadow: 0 25px 45px rgba(0,0,0,0.1);
	border: 1px solid rgba(255,255,255,0.1);
	border-right: 1px solid rgba(255,255,255,0.1);
	border-bottom: 1px solid rgba(255,255,255,0.1);
}
.from{
	position: relative;
	width: 100%;
	height: 100%;
	padding: 50px;
}
.from h2{
	position: relative;
	clear: #fff;
	font-size: 24px;
	font-weight: 600;
	letter-spacing: 5px;
	margin-bottom: 30px;
	cursor: pointer;
}
/* 登录下样式 */
.from h2::before{
	content:"";
	position: absolute;
	bottom: -5px;
	width: 0px;
	height:3px;
	background: #fff;
	transition: 0.5s;
}
.from h2::before::before{
	width: 53px;
}
.from .inputbox{
	width: 100%;
	margin-top: 20px;
}
.from .inputbox input{
	width: 100%;
	padding: 10px 20px;
	background: rgba(255,255,255,0.3);
	outline: none;
	border: none;
	border-radius:30px;
	border: 1px solid rgba(255,255,255,0.1);
	border-right: 1px solid rgba(255,255,255,0.1);
	border-bottom: 1px solid rgba(255,255,255,0.1);
	font-size: 16px;
	letter-spacing: 1px;
	color:#fff;
	box-shadow: 0 5px 15px rgba(0,0,0,0.5) ;
	
}
.from .inputbox input::placeholder{
	clear: #fff;
}
/* 登录按钮样式 */
.from .inputbox input[type="submit"]{
	background: #fff;
	color: #666;
	max-width: 120px;
	margin-bottom: 20px ;
	font-weight: 600;
	cursor: pointer;
}
.forget{
	margin-top:5px ;
	color: blue;
	letter-spacing: 1px;
	
}
.forget a {
	font-weight: 600;
	text-decoration: none;
	color: pink;
}

现象

Logo

为开发者提供学习成长、分享交流、生态实践、资源工具等服务,帮助开发者快速成长。

更多推荐