给我一个设置表单的css案例
时间: 2023-04-01 15:03:18 浏览: 98
好的,以下是一个简单的设置表单的 CSS 案例:
HTML 代码:
```
<form>
<label for="name">姓名:</label>
<input type="text" id="name" name="name" required>
<label for="email">邮箱:</label>
<input type="email" id="email" name="email" required>
<label for="password">密码:</label>
<input type="password" id="password" name="password" required>
<input type="submit" value="提交">
</form>
```
CSS 代码:
```
form {
display: flex;
flex-direction: column;
align-items: center;
}
label {
margin-top: 1rem;
font-weight: bold;
}
input {
padding: .5rem;
border: 1px solid #ccc;
border-radius: .25rem;
margin-top: .5rem;
width: 100%;
}
input[type="submit"] {
background-color: #007bff;
color: #fff;
border: none;
border-radius: .25rem;
padding: .5rem 1rem;
margin-top: 1rem;
cursor: pointer;
}
input[type="submit"]:hover {
background-color: #0069d9;
}
```