HTML 表单制作教程 - 创建一个简单且美观的联系表单
<!DOCTYPE html>
<html>
<head>
<title>联系我们表单</title>
<style>
body{
font-family: Arial, sans-serif;
background-color: #f8f8f8;
margin: 0;
padding: 0;
}
h1{
text-align: center;
margin-top: 50px;
color: #333;
}
form{
width: 500px;
margin: 0 auto;
background-color: #fff;
padding: 20px;
border-radius: 10px;
box-shadow: 0 0 10px rgba(0,0,0,0.2);
}
label{
display: block;
margin-bottom: 10px;
color: #666;
}
input[type='text'], input[type='email'], textarea{
padding: 10px;
border: 1px solid #ccc;
border-radius: 5px;
width: 100%;
margin-bottom: 20px;
font-size: 16px;
}
textarea{
height: 100px;
}
input[type='submit']{
background-color: #333;
color: #fff;
padding: 10px 20px;
border: none;
border-radius: 5px;
font-size: 16px;
cursor: pointer;
transition: background-color 0.3s ease;
}
input[type='submit']:hover{
background-color: #555;
}
</style>
</head>
<body>
<h1>联系我们</h1>
<form action='' method='post'>
<label for='name'>姓名:</label>
<input type='text' id='name' name='name' required>
<pre><code> <label for='email'>邮箱:</label>
<input type='email' id='email' name='email' required>
<label for='subject'>主题:</label>
<input type='text' id='subject' name='subject' required>
<label for='message'>消息:</label>
<textarea id='message' name='message' required></textarea>
<input type='submit' value='发送'>
</form>
</code></pre>
</body>
</html>
原文地址: https://www.cveoy.top/t/topic/muZg 著作权归作者所有。请勿转载和采集!