<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>demo</title>
</head>
<body>
<h1 align="center">用户反馈表单</h1>
<form method="post">
<p>
姓 名:
<input type="text" class="txt" size="12" maxlength="20" name="username"/>
</p>
<p>
性 别:
<input type="radio" name="sex" value="male"/>男
<input type="radio" name="sex" value="female"/>女
</p>
<p>
年 龄:
<input type="text" class="txt" name="age"/>
</p>
<p>
联系电话:
<input type="text" class="txt" name="tel"/>
</p>
<p>
电子邮箱:
<input type="text" class="txt" name="email"/>
</p>
<p>
联系地址:
<input type="text" class="txt" name="address"/>
</p>
<p>
请输入您对本网站的建议:
<br/>
<textarea name="your_suggestion" cols="50" rows="5"></textarea>
<br/>
<input type="submit" name="submit" value="提交"/>
<input type="reset" name="reset" value="清除"/>
</p>
</form>
</body>
</html>
效果:
加点颜色:
效果:
代码:
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>用户反馈表单</title>
<style>
body {
font-family: Arial, sans-serif;
background-color: #f0f5f9;
margin: 0;
padding: 0;
}
.container {
max-width: 600px;
margin: 20px auto;
padding: 20px;
background-color: #fff;
border-radius: 8px;
box-shadow: 0px 0px 10px rgba(0, 0, 0, 0.1);
}
h1 {
text-align: center;
color: #2980b9;
}
form {
margin-top: 20px;
}
p {
margin-bottom: 15px;
}
input[type="text"],
input[type="submit"],
input[type="reset"],
textarea {
width: 100%;
padding: 10px;
margin-top: 5px;
border: 1px solid #ccc;
border-radius: 4px;
box-sizing: border-box;
}
input[type="submit"],
input[type="reset"] {
background-color: #2980b9;
color: #fff;
cursor: pointer;
}
input[type="submit"]:hover,
input[type="reset"]:hover {
background-color: #1a5276;
}
@media only screen and (max-width: 600px) {
.container {
max-width: 100%;
border-radius: 0;
box-shadow: none;
padding: 10px;
}
}
</style>
</head>
<body>
<div class="container">
<h1>用户反馈表单</h1>
<form method="post">
<p>
姓名:
<input type="text" class="txt" maxlength="20" name="username"/>
</p>
<p>
性别:
<input type="radio" name="sex" value="male"/>男
<input type="radio" name="sex" value="female"/>女
</p>
<p>
年龄:
<input type="text" class="txt" name="age"/>
</p>
<p>
联系电话:
<input type="text" class="txt" name="tel"/>
</p>
<p>
电子邮箱:
<input type="text" class="txt" name="email"/>
</p>
<p>
联系地址:
<input type="text" class="txt" name="address"/>
</p>
<p>
请输入您对本网站的建议:<br/>
<textarea name="your_suggestion" cols="50" rows="5"></textarea>
<br/>
<input type="submit" name="submit" value="提交"/>
<input type="reset" name="reset" value="清除"/>
</p>
</form>
</div>
</body>
</html>