设计一个个人博客主页布局
时间: 2024-01-08 13:12:56 浏览: 19
好的,以下是一个简单的个人博客主页布局设计,希望能够帮到你:
```
<!DOCTYPE html>
<html>
<head>
<title>个人博客</title>
<style>
/* 全局样式 */
* {
margin: 0;
padding: 0;
box-sizing: border-box;
}
body {
font-family: Arial, sans-serif;
font-size: 16px;
line-height: 1.5;
color: #333;
}
/* 头部样式 */
header {
display: flex;
justify-content: space-between;
align-items: center;
padding: 20px;
background-color: #f7f7f7;
}
header h1 {
font-size: 32px;
font-weight: bold;
color: #333;
}
header nav {
display: flex;
justify-content: space-between;
align-items: center;
}
header nav a {
display: inline-block;
margin-left: 20px;
color: #333;
text-decoration: none;
transition: all 0.3s ease-in-out;
}
header nav a:hover {
color: #f00;
}
/* 主体内容样式 */
main {
display: flex;
flex-wrap: wrap;
justify-content: space-between;
padding: 20px;
margin-top: 20px;
}
.post {
flex-basis: calc(33.33% - 20px);
margin-bottom: 20px;
padding: 20px;
background-color: #f7f7f7;
box-shadow: 0 0 10px rgba(0,0,0,0.1);
}
.post h2 {
font-size: 24px;
font-weight: bold;
color: #333;
margin-bottom: 10px;
}
.post p {
font-size: 16px;
line-height: 1.5;
color: #666;
margin-bottom: 10px;
}
.post a {
display: inline-block;
color: #f00;
text-decoration: none;
transition: all 0.3s ease-in-out;
}
.post a:hover {
color: #333;
}
/* 底部样式 */
footer {
text-align: center;
padding: 20px;
background-color: #f7f7f7;
}
footer p {
font-size: 14px;
color: #999;
}
</style>
</head>
<body>
<!-- 头部 -->
<header>
<h1>个人博客</h1>
<nav>
<a href="#">首页</a>
<a href="#">关于我</a>
<a href="#">联系我</a>
</nav>
</header>
<!-- 主体内容 -->
<main>
<div class="post">
<h2>文章标题1</h2>
<p>文章内容文章内容文章内容文章内容文章内容文章内容文章内容文章内容文章内容文章内容</p>
<a href="#">阅读更多</a>
</div>
<div class="post">
<h2>文章标题2</h2>
<p>文章内容文章内容文章内容文章内容文章内容文章内容文章内容文章内容文章内容文章内容</p>
<a href="#">阅读更多</a>
</div>
<div class="post">
<h2>文章标题3</h2>
<p>文章内容文章内容文章内容文章内容文章内容文章内容文章内容文章内容文章内容文章内容</p>
<a href="#">阅读更多</a>
</div>
<div class="post">
<h2>文章标题4</h2>
<p>文章内容文章内容文章内容文章内容文章内容文章内容文章内容文章内容文章内容文章内容</p>
<a href="#">阅读更多</a>
</div>
<div class="post">
<h2>文章标题5</h2>
<p>文章内容文章内容文章内容文章内容文章内容文章内容文章内容文章内容文章内容文章内容</p>
<a href="#">阅读更多</a>
</div>
<div class="post">
<h2>文章标题6</h2>
<p>文章内容文章内容文章内容文章内容文章内容文章内容文章内容文章内容文章内容文章内容</p>
<a href="#">阅读更多</a>
</div>
</main>
<!-- 底部 -->
<footer>
<p>版权所有 © 2021 个人博客</p>
</footer>
</body>
</html>
```
该布局采用了简单的HTML和CSS代码,包括了头部、主体内容和底部三个部分。其中,头部包含了网站标题和导航栏,主体内容部分采用了flexbox布局实现了文章列表展示,底部则包含了版权信息。你可以根据自己的需要进行修改和美化。