用HTML+CSS写一个注册界面
时间: 2024-03-13 16:21:13 浏览: 16
好的,以下是一个简单的注册界面的HTML和CSS代码示例:
```html
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Register</title>
<link rel="stylesheet" href="style.css">
</head>
<body>
<div class="container">
<h1>Register</h1>
<form>
<label for="username">Username:</label>
<input type="text" id="username" required>
<label for="password">Password:</label>
<input type="password" id="password" required>
<label for="confirm-password">Confirm Password:</label>
<input type="password" id="confirm-password" required>
<label for="email">Email:</label>
<input type="email" id="email" required>
<button type="submit">Submit</button>
</form>
</div>
</body>
</html>
```
```css
* {
box-sizing: border-box;
margin: 0;
padding: 0;
}
.container {
max-width: 500px;
margin: 0 auto;
padding: 20px;
background-color: #f2f2f2;
border-radius: 5px;
box-shadow: 0 0 10px rgba(0, 0, 0, 0.2);
}
h1 {
text-align: center;
margin-bottom: 20px;
}
form {
display: flex;
flex-direction: column;
}
label {
font-weight: bold;
margin-bottom: 5px;
}
input {
padding: 10px;
margin-bottom: 10px;
border: none;
border-radius: 5px;
}
button {
padding: 10px;
background-color: #4CAF50;
color: #fff;
border: none;
border-radius: 5px;
cursor: pointer;
transition: all 0.3s ease;
}
button:hover {
background-color: #3e8e41;
}
```
这段代码会创建一个包含用户名、密码、确认密码和电子邮件的表单,并在提交按钮被点击时提交表单。
你可以将这些代码保存为HTML文件和CSS文件,然后通过浏览器打开HTML文件来查看它们的效果。