<!DOCTYPE html>
<html lang="zh-CN">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>用户登录 - QSZ</title>
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/5.15.4/css/all.min.css">
<style>
:root {
--primary-color: #4f46e5;
--secondary-color: #818cf8;
--text-color: #1f2937;
--bg-color: #f3f4f6;
--white: #ffffff;
--error-color: #ef4444;
--success-color: #10b981;
}
* {
margin: 0;
padding: 0;
box-sizing: border-box;
}
body {
font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
min-height: 100vh;
display: flex;
align-items: center;
justify-content: center;
padding: 1rem;
}
.container {
background: var(--white);
border-radius: 1rem;
box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1);
overflow: hidden;
width: 100%;
max-width: 400px;
position: relative;
}
.forms-container {
position: relative;
width: 100%;
height: 100%;
}
.form-section {
padding: 2rem;
transition: transform 0.3s ease-in-out;
}
.form-title {
font-size: 1.5rem;
color: var(--text-color);
margin-bottom: 1.5rem;
text-align: center;
font-weight: 600;
}
.form-group {
margin-bottom: 1.5rem;
position: relative;
}
.form-group label {
display: block;
margin-bottom: 0.5rem;
color: var(--text-color);
font-size: 0.875rem;
}
.form-group input {
width: 100%;
padding: 0.75rem 1rem;
border: 1px solid #e5e7eb;
border-radius: 0.5rem;
font-size: 1rem;
transition: border-color 0.3s ease;
}
.form-group input:focus {
outline: none;
border-color: var(--primary-color);
box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.1);
}
.form-group .icon {
position: absolute;
right: 1rem;
top: 2.5rem;
color: #9ca3af;
}
.btn {
width: 100%;
padding: 0.75rem 1.5rem;
border: none;
border-radius: 0.5rem;
background: var(--primary-color);
color: var(--white);
font-size: 1rem;
font-weight: 500;
cursor: pointer;
transition: background-color 0.3s ease;
}
.btn:hover {
background: var(--secondary-color);
}
.form-footer {
text-align: center;
margin-top: 1.5rem;
}
.form-footer a {
color: var(--primary-color);
text-decoration: none;
font-size: 0.875rem;
}
.form-footer a:hover {
text-decoration: underline;
}
.divider {
display: flex;
align-items: center;
margin: 1.5rem 0;
color: #6b7280;
}
.divider::before,
.divider::after {
content: "";
flex: 1;
height: 1px;
background: #e5e7eb;
}
.divider span {
padding: 0 1rem;
font-size: 0.875rem;
}
.social-login {
display: flex;
gap: 1rem;
margin-top: 1.5rem;
}
.social-btn {
flex: 1;
padding: 0.75rem;
border: 1px solid #e5e7eb;
border-radius: 0.5rem;
background: var(--white);
color: var(--text-color);
font-size: 1.25rem;
cursor: pointer;
transition: background-color 0.3s ease;
}
.social-btn:hover {
background: var(--bg-color);
}
.hidden {
display: none;
}
.alert {
padding: 0.75rem 1rem;
border-radius: 0.5rem;
margin-bottom: 1rem;
font-size: 0.875rem;
}
.alert-error {
background: #fef2f2;
color: var(--error-color);
border: 1px solid #fee2e2;
}
.alert-success {
background: #ecfdf5;
color: var(--success-color);
border: 1px solid #d1fae5;
}
@media (max-width: 640px) {
.container {
margin: 1rem;
}
}
</style>
</head>
<body>
<div class="container">
<div class="forms-container">
<!-- 登录表单 -->
<div class="form-section" id="login-form">
<h2 class="form-title">欢迎回来</h2>
<form onsubmit="return false;">
<div class="form-group">
<label for="login-email">邮箱地址</label>
<input type="email" id="login-email" required>
<i class="fas fa-envelope icon"></i>
</div>
<div class="form-group">
<label for="login-password">密码</label>
<input type="password" id="login-password" required>
<i class="fas fa-lock icon"></i>
</div>
<div style="text-align: right; margin-bottom: 1rem;">
<a href="#" onclick="showForm('forgot-form')">忘记密码?</a>
</div>
<button class="btn">登录</button>
<div class="divider">
<span>或者使用</span>
</div>
<div class="social-login">
<button class="social-btn"><i class="fab fa-weixin"></i></button>
<button class="social-btn"><i class="fab fa-qq"></i></button>
<button class="social-btn"><i class="fab fa-github"></i></button>
</div>
<div class="form-footer">
<span>还没有账号?</span>
<a href="#" onclick="showForm('register-form')">立即注册</a>
</div>
</form>
</div>
<!-- 注册表单 -->
<div class="form-section hidden" id="register-form">
<h2 class="form-title">创建账号</h2>
<form onsubmit="return false;">
<div class="form-group">
<label for="register-username">用户名</label>
<input type="text" id="register-username" required>
<i class="fas fa-user icon"></i>
</div>
<div class="form-group">
<label for="register-email">邮箱地址</label>
<input type="email" id="register-email" required>
<i class="fas fa-envelope icon"></i>
</div>
<div class="form-group">
<label for="register-password">密码</label>
<input type="password" id="register-password" required>
<i class="fas fa-lock icon"></i>
</div>
<div class="form-group">
<label for="register-confirm-password">确认密码</label>
<input type="password" id="register-confirm-password" required>
<i class="fas fa-lock icon"></i>
</div>
<button class="btn">注册</button>
<div class="form-footer">
<span>已有账号?</span>
<a href="#" onclick="showForm('login-form')">立即登录</a>
</div>
</form>
</div>
<!-- 忘记密码表单 -->
<div class="form-section hidden" id="forgot-form">
<h2 class="form-title">重置密码</h2>
<p style="text-align: center; margin-bottom: 1.5rem; color: #6b7280;">
请输入您的邮箱地址,我们将向您发送重置密码的链接
</p>
<form onsubmit="return false;">
<div class="form-group">
<label for="forgot-email">邮箱地址</label>
<input type="email" id="forgot-email" required>
<i class="fas fa-envelope icon"></i>
</div>
<button class="btn">发送重置链接</button>
<div class="form-footer">
<a href="#" onclick="showForm('login-form')">返回登录</a>
</div>
</form>
</div>
</div>
</div>
<script>
function showForm(formId) {
// 隐藏所有表单
document.querySelectorAll('.form-section').forEach(form => {
form.classList.add('hidden');
});
// 显示目标表单
document.getElementById(formId).classList.remove('hidden');
}
</script>
</body>
</html>
标签:界面,form,登录,color,--,rem,var,border From: https://www.cnblogs.com/qsz666/p/18552506