帮我写一个用户留言的html,要求有按钮选项等功能
时间: 2024-02-13 14:03:27 浏览: 28
好的,以下是一个简单的用户留言的HTML代码,其中包含了按钮选项等功能:
```html
<!DOCTYPE html>
<html>
<head>
<title>用户留言</title>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<style>
form {
display: flex;
flex-direction: column;
align-items: center;
margin-top: 50px;
font-size: 18px;
}
input[type="text"], textarea {
width: 80%;
padding: 10px;
margin: 10px;
border-radius: 5px;
border: none;
box-shadow: 0px 0px 5px 2px rgba(0,0,0,0.1);
}
textarea {
height: 150px;
}
button {
padding: 10px 20px;
background-color: #007bff;
color: #fff;
border: none;
border-radius: 5px;
box-shadow: 0px 0px 5px 2px rgba(0,0,0,0.1);
cursor: pointer;
transition: background-color 0.3s ease-in-out;
}
button:hover {
background-color: #0056b3;
}
</style>
</head>
<body>
<form>
<label for="name">姓名:</label>
<input type="text" id="name" name="name" required>
<label for="email">邮箱:</label>
<input type="text" id="email" name="email" required>
<label for="message">留言:</label>
<textarea id="message" name="message" required></textarea>
<button type="submit">提交留言</button>
<button type="reset">重置表单</button>
</form>
</body>
</html>
```
在这个HTML代码中,我们使用了`form`元素来包含用户留言的表单,其中有三个输入框,分别是姓名、邮箱和留言。每个输入框都使用了`input`元素或`textarea`元素来实现。
我们还添加了两个按钮,分别是“提交留言”和“重置表单”。这两个按钮都使用了`button`元素来实现,其中“提交留言”按钮使用了`type="submit"`属性,表示点击该按钮会提交表单到后台进行处理;而“重置表单”按钮使用了`type="reset"`属性,表示点击该按钮会重置所有表单元素的值。
最后,我们使用了CSS样式来美化表单和按钮,并提供了一些交互效果,例如当鼠标悬停在按钮上时,按钮的背景颜色会变化。
相关推荐
![pdf](https://img-home.csdnimg.cn/images/20210720083512.png)
![zip](https://img-home.csdnimg.cn/images/20210720083736.png)
![pdf](https://img-home.csdnimg.cn/images/20210720083512.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)
![zip](https://img-home.csdnimg.cn/images/20210720083736.png)