首页 话题 小组 问答 好文 用户 我的社区 域名交易 唠叨

[分享]css3怎么建博客

发布于 2024-11-11 15:25:44
0
34

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;
} 

有了这些代码,我们就可以构建出一个简单的博客页面。

评论
一个月内的热帖推荐
91云脑
Lv.1普通用户

62849

帖子

14

小组

291

积分

赞助商广告
站长交流