html css 好看的提交表单
时间: 2023-08-31 15:12:48 浏览: 114
以下是一个简单的HTML和CSS代码,用于创建一个漂亮的提交表单:
HTML代码:
```html
<form>
<label for="name">Name:</label>
<input type="text" id="name" name="name" required>
<label for="email">Email:</label>
<input type="email" id="email" name="email" required>
<label for="subject">Subject:</label>
<input type="text" id="subject" name="subject" required>
<label for="message">Message:</label>
<textarea id="message" name="message" required></textarea>
<input type="submit" value="Submit">
</form>
```
CSS代码:
```css
form {
display: flex;
flex-direction: column;
align-items: center;
border: 1px solid #ccc;
padding: 20px;
border-radius: 10px;
box-shadow: 0 0 10px rgba(0, 0, 0, 0.2);
width: 400px;
margin: 0 auto;
}
label {
font-size: 18px;
margin: 10px 0;
text-align: left;
width: 100%;
}
input,
textarea {
border: 2px solid #ccc;
border-radius: 5px;
padding: 10px;
font-size: 16px;
width: 100%;
margin-bottom: 20px;
}
input[type="submit"] {
background-color: #4CAF50;
color: white;
padding: 12px 20px;
border: none;
border-radius: 4px;
cursor: pointer;
font-size: 18px;
}
input[type="submit"]:hover {
background-color: #3e8e41;
}
```
你可以将这些代码保存为HTML文件,然后在浏览器中打开以查看效果。
阅读全文