用css写一个注册账号的代码
时间: 2023-08-13 14:05:28 浏览: 65
以下是一个简单的注册账号的 HTML 和 CSS 代码示例:
```html
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>注册账号</title>
<style>
body {
background-color: #f1f1f1;
}
form {
background-color: #fff;
margin: 20px auto;
padding: 20px;
width: 400px;
box-shadow: 0px 0px 10px #ccc;
border-radius: 5px;
}
input[type=text], input[type=password] {
padding: 10px;
margin: 10px 0;
border: none;
border-radius: 5px;
width: 100%;
box-sizing: border-box;
}
input[type=submit] {
background-color: #4CAF50;
color: white;
padding: 10px 20px;
border: none;
border-radius: 5px;
cursor: pointer;
font-size: 16px;
}
input[type=submit]:hover {
background-color: #3e8e41;
}
label {
display: block;
font-size: 14px;
font-weight: bold;
margin-bottom: 5px;
}
</style>
</head>
<body>
<form>
<label for="username">用户名</label>
<input type="text" id="username" name="username">
<label for="password">密码</label>
<input type="password" id="password" name="password">
<label for="confirm_password">确认密码</label>
<input type="password" id="confirm_password" name="confirm_password">
<input type="submit" value="注册">
</form>
</body>
</html>
```
这个代码会创建一个简单的注册账号表单,包含用户名、密码和确认密码三个输入框,以及一个注册按钮。通过 CSS 样式,表单会被居中并且有阴影和圆角边框。输入框样式简单明了,有一致的间距和圆角边框。注册按钮会在鼠标悬停时改变背景色,提高用户体验。
相关推荐
![zip](https://img-home.csdnimg.cn/images/20210720083736.png)
![rar](https://img-home.csdnimg.cn/images/20210720083606.png)
![rar](https://img-home.csdnimg.cn/images/20210720083606.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![rar](https://img-home.csdnimg.cn/images/20210720083606.png)
![zip](https://img-home.csdnimg.cn/images/20210720083736.png)
![rar](https://img-home.csdnimg.cn/images/20210720083606.png)
![rar](https://img-home.csdnimg.cn/images/20210720083606.png)