htmlcss静态个人博客代码
时间: 2023-07-29 21:08:04 浏览: 106
很遗憾,由于回答框架的限制,我无法在这里展示完整的 HTML/CSS 静态个人博客代码。不过,你可以参考以下范例代码,了解如何搭建一个基本的静态个人博客页面:
HTML 代码:
```
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>My Blog</title>
<link rel="stylesheet" href="style.css">
</head>
<body>
<header>
<h1>My Blog</h1>
<nav>
<ul>
<li><a href="#">Home</a></li>
<li><a href="#">About</a></li>
<li><a href="#">Blog</a></li>
<li><a href="#">Contact</a></li>
</ul>
</nav>
</header>
<main>
<article>
<header>
<h2>My First Blog Post</h2>
<p>Posted on January 1, 2022</p>
</header>
<section>
<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Sed eget risus augue. Aliquam erat volutpat. Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas. Nulla facilisi. Integer sodales augue eget arcu commodo, vel euismod dolor sollicitudin. Sed auctor, nisl ut placerat pretium, lorem nisi consequat nisi, vel accumsan nisi risus eu odio.</p>
<p>Maecenas mattis, nunc vitae euismod finibus, quam velit pellentesque est, vel efficitur metus purus euismod nisl. Sed vel imperdiet nisi. Mauris dignissim risus in mauris bibendum, quis suscipit enim euismod. Sed laoreet euismod odio, et elementum mauris malesuada nec. In faucibus lectus ut nisi tristique, nec malesuada dolor pretium. Donec ut massa id lectus dictum pellentesque.</p>
</section>
</article>
</main>
<footer>
<p>© 2022 My Blog</p>
</footer>
</body>
</html>
```
CSS 代码:
```
body {
margin: 0;
padding: 0;
font-family: Arial, sans-serif;
font-size: 16px;
line-height: 1.5;
color: #333;
}
header {
background-color: #f2f2f2;
padding: 1em;
}
h1 {
margin: 0;
font-size: 2em;
}
nav ul {
list-style: none;
margin: 0;
padding: 0;
}
nav ul li {
display: inline-block;
margin-right: 1em;
}
nav ul li:last-child {
margin-right: 0;
}
nav ul li a {
text-decoration: none;
color: #333;
}
main {
max-width: 800px;
margin: 0 auto;
padding: 2em;
}
article {
margin-bottom: 2em;
}
article header {
margin-bottom: 1em;
}
article header h2 {
margin: 0;
font-size: 1.5em;
}
article header p {
margin: 0;
font-size: 0.8em;
color: #999;
}
section p {
margin-bottom: 1em;
}
footer {
background-color: #f2f2f2;
padding: 1em;
text-align: center;
}
```
以上代码实现了一个简单的静态个人博客页面,包括头部、导航、文章、页脚等元素和样式。你可以根据自己的需求和喜好进行修改和扩展。
阅读全文