html+css网页代码
时间: 2023-12-12 09:35:44 浏览: 30
以下是一个简单的HTML+CSS网页代码的例子:
```html
<!DOCTYPE html>
<html>
<head>
<title>My Website</title>
<style>
body {
background-color: #f2f2f2;
font-family: Arial, sans-serif;
}
h1 {
color: #333;
text-align: center;
}
p {
color: #666;
font-size: 18px;
line-height: 1.5;
margin: 20px;
}
</style>
</head>
<body>
<h1>Welcome to My Website</h1>
<p>This is a paragraph of text on my website. Lorem ipsum dolor sit amet, consectetur adipiscing elit. Sed euismod, diam vel tincidunt bibendum, velit sapien bibendum nunc, vel bibendum sapien sapien vel nunc. Sed euismod, diam vel tincidunt bibendum, velit sapien bibendum nunc, vel bibendum sapien sapien vel nunc.</p>
</body>
</html>
```
这个例子包含了一个HTML文档的基本结构,以及一个简单的CSS样式表。在这个例子中,我们定义了一个背景颜色、字体和文本样式,然后将这些样式应用到了网页的不同元素上。具体来说,我们将背景颜色应用到了整个页面的body元素上,将标题的颜色和对齐方式应用到了h1元素上,将段落的颜色、字体大小、行高和边距应用到了p元素上。