HTML结课作业设计代码
时间: 2023-07-31 22:06:03 浏览: 44
以下是一个简单的 HTML 结课作业设计代码示例,其中包括一个表单和一些样式设计:
```html
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>HTML 结课作业设计</title>
<style>
body {
font-family: Arial, sans-serif;
margin: 0;
padding: 0;
background-color: #f2f2f2;
}
.container {
max-width: 960px;
margin: 0 auto;
padding: 50px 20px;
}
h1 {
font-size: 48px;
margin-top: 0;
margin-bottom: 20px;
color: #333;
text-align: center;
text-shadow: 2px 2px #ccc;
}
form {
padding: 20px;
background-color: #fff;
box-shadow: 2px 2px 10px #ccc;
border-radius: 10px;
}
label {
display: block;
font-size: 18px;
margin-bottom: 10px;
color: #333;
}
input[type="text"],
input[type="email"],
textarea {
display: block;
width: 100%;
padding: 10px;
font-size: 18px;
margin-bottom: 20px;
border: none;
border-radius: 5px;
box-shadow: 2px 2px 10px #ccc;
background-color: #f2f2f2;
color: #333;
resize: none;
}
input[type="submit"] {
display: inline-block;
padding: 10px 20px;
font-size: 18px;
background-color: #333;
color: #fff;
border: none;
border-radius: 5px;
box-shadow: 2px 2px 10px #ccc;
cursor: pointer;
transition: background-color .2s ease-in-out;
}
input[type="submit"]:hover {
background-color: #666;
}
</style>
</head>
<body>
<div class="container">
<h1>HTML 结课作业设计</h1>
<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="message">留言:</label>
<textarea id="message" name="message" rows="10" required></textarea>
<input type="submit" value="提交">
</form>
</div>
</body>
</html>
```
在上面的代码中,通过使用 CSS 的盒模型、阴影、圆角、过渡和鼠标指针等属性,为表单增加了一些样式设计。例如,输入框通过设置宽度、内边距、边框、圆角和阴影等属性,实现了简洁美观的效果,提交按钮通过设置背景色、颜色、边框、圆角和过渡效果,提高了交互性和美观性。同时,通过添加必填项和设置输入类型,增加了表单的安全性和正确性。
相关推荐
![zip](https://img-home.csdnimg.cn/images/20210720083736.png)
![zip](https://img-home.csdnimg.cn/images/20210720083736.png)
![rar](https://img-home.csdnimg.cn/images/20210720083606.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)
![](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)