给我三个包含css样式的html网页代码
时间: 2023-11-29 07:06:23 浏览: 30
以下是三个包含 CSS 样式的 HTML 网页代码示例:
1. index.html
```html
<!DOCTYPE html>
<html>
<head>
<title>首页</title>
<style>
h1 {
color: red;
font-size: 36px;
text-align: center;
}
p {
font-size: 18px;
line-height: 1.5;
margin: 20px;
}
</style>
</head>
<body>
<h1>欢迎来到我的网站!</h1>
<p>这是我的第一个网页。</p>
</body>
</html>
```
2. about.html
```html
<!DOCTYPE html>
<html>
<head>
<title>关于我们</title>
<style>
h1 {
color: blue;
font-size: 36px;
text-align: center;
}
p {
font-size: 18px;
line-height: 1.5;
margin: 20px;
}
</style>
</head>
<body>
<h1>关于我们</h1>
<p>我们是一家专业的网站开发公司,致力于为客户提供最优质的服务。</p>
</body>
</html>
```
3. contact.html
```html
<!DOCTYPE html>
<html>
<head>
<title>联系我们</title>
<style>
h1 {
color: green;
font-size: 36px;
text-align: center;
}
form {
margin: 20px;
}
label {
display: block;
font-size: 18px;
margin-bottom: 10px;
}
input[type="text"],
input[type="email"],
textarea {
display: block;
width: 100%;
padding: 10px;
font-size: 18px;
border: 1px solid #ccc;
border-radius: 5px;
margin-bottom: 20px;
}
input[type="submit"] {
display: block;
width: 100%;
padding: 10px;
font-size: 18px;
background-color: green;
color: white;
border: none;
border-radius: 5px;
cursor: pointer;
}
</style>
</head>
<body>
<h1>联系我们</h1>
<p>如果您有任何问题或建议,请填写以下表格与我们取得联系:</p>
<form action="submit.php" method="post">
<label>姓名:</label><input type="text" name="name">
<label>邮箱:</label><input type="email" name="email">
<label>留言:</label><textarea name="message"></textarea>
<input type="submit" value="提交">
</form>
</body>
</html>
```
以上三个 HTML 网页都包含了 CSS 样式的定义,可以通过样式改变网页元素的颜色、大小、对齐方式等等。这些样式定义都在网页的 head 元素中的 style 元素中进行。可以看到,这些样式定义都是针对特定的 HTML 元素进行的。