CSS3可以帮助我们构建出漂亮的博客页面,下面是一些常用的CSS3技巧:
/* 设置标题样式 */
h1 {
font-size: 36px;
font-weight: bold;
color: #333;
text-align: center;
}
/* 设置导航菜单样式 */
nav {
display: flex;
justify-content: space-between;
background-color: #f5f5f5;
}
nav ul {
display: flex;
list-style: none;
margin: 0;
padding: 0;
}
nav li {
margin-left: 20px;
}
nav a {
display: block;
text-decoration: none;
color: #666;
padding: 10px;
}
nav a:hover {
background-color: #ccc;
}
/* 设置文章列表样式 */
article {
width: 60%;
margin: 0 auto;
}
.post {
margin-bottom: 20px;
padding: 20px;
background-color: #fff;
box-shadow: 0px 0px 5px rgba(0, 0, 0, 0.3);
}
.post h2 {
font-size: 24px;
margin-bottom: 10px;
}
.post p {
line-height: 1.5;
margin-bottom: 20px;
}
/* 设置页脚样式 */
footer {
text-align: center;
padding: 20px;
background-color: #f5f5f5;
} 有了这些代码,我们就可以构建出一个简单的博客页面。