利用js,HTML,css写一个注册登录页面
时间: 2024-03-24 16:36:08 浏览: 19
当然可以,下面是一个例子:
HTML代码:
```
<!DOCTYPE html>
<html>
<head>
<title>注册页面</title>
<meta charset="utf-8">
<link rel="stylesheet" type="text/css" href="style.css">
</head>
<body>
<div class="container">
<h1>注册</h1>
<form action="register.php" method="post">
<label for="username">用户名:</label>
<input type="text" id="username" name="username" required>
<label for="password">密码:</label>
<input type="password" id="password" name="password" required>
<label for="email">邮箱:</label>
<input type="email" id="email" name="email" required>
<input type="submit" value="注册">
</form>
<p>已有账户?<a href="login.html">点击登录</a></p>
</div>
</body>
</html>
```
CSS代码:
```
.container {
max-width: 350px;
margin: 50px auto;
padding: 20px;
background-color: #f2f2f2;
border-radius: 5px;
box-shadow: 0 0 10px rgba(0, 0, 0, 0.3);
}
h1 {
text-align: center;
margin-bottom: 30px;
}
form {
display: flex;
flex-direction: column;
}
label {
margin-top: 10px;
}
input[type="text"], input[type="password"], input[type="email"] {
padding: 10px;
border-radius: 5px;
border: none;
margin-bottom: 20px;
}
input[type="submit"] {
background-color: #4CAF50;
color: white;
padding: 10px 20px;
border: none;
border-radius: 5px;
cursor: pointer;
margin-bottom: 20px;
}
input[type="submit"]:hover {
background-color: #3e8e41;
}
p {
text-align: center;
margin-top: 20px;
}
a {
color: #4CAF50;
text-decoration: none;
}
a:hover {
text-decoration: underline;
}
```
这是一个简单的注册页面,你可以根据需要进行修改和完善。同时,你还需要编写一个`register.php`文件来处理用户提交的注册数据,这里就不再赘述。