Typecho默认主题修改记录
Typecho默认主题不够美观,参考其他网友的设置,修改成自己喜欢的样式,详细记录如下。
- 修改默认字体修改和超链接文字颜色
font-family:"Hiragino Sans GB","Microsoft YaHei",STHeiti,"WenQuanYi Micro Hei",Helvetica,Arial,sans-serif;
font-size: 90%;
}
a {
color: #444;
text-decoration: none;
}
a:hover, a:active {
color: #444;
}
- 修改网站标题字体大小、副标题字体样式
#logo {
color: #444;
font-size: 1.8em;
font-weight: bold;
line-height: 2.5;
}
#logo img {
max-height: 64px;
}
.description {
margin: .5em 0 0;
color: #444;
font-style: normal;
}
- 删除链接下划线
.post-meta a,
.post-content a,
.widget a,
.comment-content a {
border-bottom: none;
}
- 修改文章标题字体大小和行高
.post-title {
margin: .83em 0;
font-size: 1.2em;
}
- 图片居中
.post-content img, .comment-content img,
.post-content video, .comment-content video {
max-width: 100%;
margin:0 auto;
display:block;
}
- 调整文章行间距
/* -----------------
* Content format
*--------------- */
.post-content, .comment-content {
line-height: 1.7;
word-wrap: break-word;
}
- 修改归档日期格式,在
sidebar.php
修改内容如下:
<?php $this->widget('Widget_Contents_Post_Date', 'type=month&format=Y年m月')->parse('<li><a href="
{permalink}">{date}</a> <span id="ignore">({count})</span></li>'); ?>
- 将Typecho分类添加到导航菜单
<?php $this->widget('Widget_Metas_Category_List')->to($category); ?>
<?php while ($category->next()): ?>
<a<?php if ($this->is('post')): ?>
<?php if ($this->category == $category->slug): ?> class="current"<?php endif; ?>
<?php else: ?>
<?php if ($this->is('category', $category->slug)): ?> class="current"<?php endif; ?>
<?php endif; ?> href="<?php $category->permalink(); ?>"><?php $category->name(); ?></a>
<?php endwhile; ?>
- 删除首页显示的作者和评论数量,在
index.php
中删除以下代码
<li itemprop="author" itemscope itemtype="http://schema.org/Person"><?php _e('作者: '); ?><a
itemprop="name" href="<?php $this->author->permalink(); ?>"
rel="author"><?php $this->author(); ?></a></li>
<li itemprop="interactionCount">
<a itemprop="discussionUrl"
href="<?php $this->permalink() ?>#comments"><?php $this->commentsNum('评论', '1 条评论', '%d 条评论'); ?></a>
</li>
- 删除导航菜单文字边框,修改显示样式
/* Navigation menu */
#nav-menu {
margin: 25px 0 0;
padding: 0;
}
#nav-menu a {
display: block;
margin-right: -1px;
padding: 0 15px;
border: none;
border-bottom: none;
height: 32px;
line-height: 32px;
color: #444;
float: left;
}
#nav-menu a:hover,
#nav-menu .current {
background: #FFF;
font-weight: bold;
}
- 修改
- 阅读剩余部分 -
左对齐
.more {
text-align: left;
}
- 修改Footer字体颜色
#footer {
padding: 3em 0;
line-height: 1.2;
text-align: center;
color: #444;
}
- 修改H2字体大小
.post-content h2, .comment-content h2 {
font-size: 1.050em;
}