html+css+jquery实现的简单的登陆注册页面
以下是一个简单的使用HTML、CSS和jQuery实现的登录注册页面示例:
HTML:
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Login & Register Form</title>
<link rel="stylesheet" href="style.css">
</head>
<body>
<div class="container">
<div class="login-container">
<h2>Login</h2>
<form id="loginForm">
<input type="text" placeholder="Username" required>
<input type="password" placeholder="Password" required>
<button type="submit">Login</button>
</form>
</div>
<div class="register-container">
<h2>Register</h2>
<form id="registerForm">
<input type="text" placeholder="Username" required>
<input type="email" placeholder="Email" required>
<input type="password" placeholder="Password" required>
<button type="submit">Register</button>
</form>
</div>
</div>
<script src="https://code.jquery.com/jquery-3.6.0.min.js"></script>
<script src="script.js"></script>
</body>
</html>
CSS (style.css):
body {
margin: 0;
font-family: Arial, sans-serif;
background-color: #f4f4f4;
}
.container {
display: flex;
align-items: center;
justify-content: center;
height: 100vh;
}
.login-container, .register-container {
width: 300px;
padding: 40px;
background-color: #fff;
border-radius: 5px;
box-shadow: 0 2px 5px rgba(0, 0, 0, 0.2);
}
.login-container h2, .register-container h2 {
text-align: center;
margin-bottom: 20px;
}
.login-container input, .register-container input {
margin-bottom: 15px;
padding: 10px;
border: 1px solid #ccc;
border-radius: 4px;
width: calc(100% - 20px);
}
.login-container button, .register-container button {
width: 100%;
padding: 10px;
background-color: #5cb85c;
color: white;
border: none;
border-radius: 4px;
cursor: pointer;
font-size: 16px;
}
.login-container button:hover, .register-container button:hover {
background-color: #4cae4c;
}
jQuery (script.js):
$(document).ready(function() {
$('#loginForm').submit(fu
评论已关闭