怸歪小站

  • 一、自定义CSS实现网站标题和底部布局调整
  • 二、通过WP-China-Yes插件来自定义主题字体
  • ①下载WP-China-Yes插件
  • ②插件设置
  • 三、未完待续
  • 网站首页
  • 所有文章
  • 工具汇总
    • 转个义
  • 记录点滴
  • 博友新章
  • 关于本站
    • 留个言
  • 文章归档
  • 榜上有名
  • 友情链接

本站已苦苦支撑

X 天 X 时 X 分 X 秒

喜欢这款主题

抢先体验 | 作者主页

【记录】通过添加自定义css修改布局,和利用WP-China-Yes修改字体。

  • 怸歪
  • 2024-12-26
  • 1

这几天闲着没事就四处逛逛,逛到了何老师的网站,看到了何老师网站的布局感觉很舒服,就要来了css文件,本着不对主题做出修改的原则,先是想创建子主题修改,后来发现对于一个非IT专业的人,看着css文件太繁了,就对比下何老师的css和原版的css,尝试自定义css的方式,居然实现了,后来又想修改下字体,发现怎么弄都太违和了,也很麻烦,在升级WP-China-Yes插件升级到3.7.1后发现能自定义文风字体。就研究着修改下主体风格,发现门槛低多了。

一、自定义CSS实现网站标题和底部布局调整

用UltraEdit对何老师和原版的style.css,进行对比,得到了喝多不同之处通过筛选,尝试,我把自定义css放出来,估计里面有很多是多余重复的,但是先这样吧。下面是我的自定义css内容。

/* 底部增加彩虹 */
.header > .container::before{content:'';position:absolute;top:-4rem;width:4px;height:4px;background-color:red;box-shadow: 4px 0 orange,8px 0 yellow,12px 0 green,16px 0 blue,20px 0 purple;}
/* 定义背景图片 */
			body{
	  background-image: url(https://cycy.fun/img/bj2.png);
    background-size: 2000px;
    background-position: center -600px;
    background-repeat: no-repeat;
    background-attachment: fixed;
}		
/* 主页字体大小 
html { font-size: 20px; }*/

/* 新增内容1 */
button.btn.btn-link.btn-sm.flex-center {
    color: #bcc3ce;
}

button.btn.btn-link.btn-sm.flex-center:hover {
    background-color: #3A98DC;
    color: #fff;
}
/* 新增内容1结束 */
/* 新增内容2 针对Firefox兼容问题 */
::-moz-selection{ /*针对Firefox*/

background:#3A98DC;   

color:#fff;   

 }   

::selection {   

background:#3A98DC;   

color:#fff;   
}

.comment-metas.flex-center.justify-start.mt-1 {
    font-size: .7rem;
}
/* 新增内容2结束 */
/* 新增内容3底部居中调整 */
[hidden] {
  display: none;
}

*,
*::before,
*::after {
  box-sizing: inherit;
}

figure.wp-block-image.aligncenter.size-large.is-resized.is-style-rounded {
    margin-left: auto;
    margin-right: auto;
}
.d-flex.flex-center.justify-between.flex-wrap {
    justify-content: center;
}
time.tile-title__time.tooltip {
    font-size: .7rem;
}

table {
    display: block;
    width: 100%;
    overflow: auto;
	   border-spacing: 0;
    border-collapse: collapse;
}

table th {
    font-weight: 600;
    padding: 6px 13px;
    border: 1px solid #dfe2e5
}

table td {
    padding: 6px 13px;
    border: 1px solid #dfe2e5
}

table tr {
    background-color: #fff;
    border-top: 1px solid #c6cbd1
}

table tr:nth-child(2n) {
    background-color: #f6f8fa
}

td {
    font-family: inherit;
    font-size: inherit;
    font-weight: inherit;
    line-height: inherit;
}
.dark table tr {
    background-color: #3b4351;
    border-top: 1px solid #000000;
}
.dark table td {
    padding: 6px 13px;
    border: 1px solid var(--wp--preset--color--cyan-bluish-gray);
}
.dark table td {
    padding: 6px 13px;
    border: 1px solid var(--wp--preset--color--cyan-bluish-gray);
}


.page-item-title:hover {
  color: #3A98DC;
}
.text-gray a:hover{
	color:#3A98DC;
}
/* PART 1 - Before Lazy Load */
img[data-lazyloaded]{
    opacity: 0;
}
/* PART 2 - Upon Lazy Load */
img.litespeed-loaded{
    -webkit-transition: opacity .5s linear 0.2s;
    -moz-transition: opacity .5s linear 0.2s;
    transition: opacity .5s linear 0.2s;
    opacity: 1;
}

.gallery{
 margin:-1%!important;
}
.gallery .gallery-item {
 padding:1%;
 /* width:14.66666%!important; */
 margin: 0 !important;
 overflow:hidden;
 position:relative;
}
.gallery-columns-3 .gallery-item{
 width:33.3333333%!important;
}
.gallery .gallery-item dt:before {
 content: "";
 display: block;
 padding-top: 100%;
}
.gallery .gallery-item dt {
 position: relative;
 box-shadow:0 0 0 1px rgba(0,0,0,.1) inset;
 background: #eee;
 cursor: pointer;
 overflow: hidden;
}
.gallery .gallery-item img{
 position:absolute;
 top: 0;
 left: 0;
 height:100%;
 width:100%;
 object-fit:cover;
 border:0!important;
}
/* 新增内容3结束 */
/* 新增内容4 */
blockquote {
    border-left: 4px solid #3A98DC;
    margin-left: 0;
    padding: 10px;
    background: #f6f6f6;
    width: 100%;
    line-height: 1.7;
}
/* 新增内容4结束 */
/* 新增内容5 */
.article-content.body {
    line-height: 1.7;
}
/* 新增内容5结束 */
/* 新增内容6 */
h3.al_year {
    font-size: 1rem;
    margin: 0;
    padding-bottom: 5px;
    padding-top: 5px;
    border-bottom: 1px solid #dadee4;
}
/* 新增内容6结束 */
/* 新增内容7 */
body .layout .uni-bg, body .layout #notes .notes-tabbar, body .layout #aside #tab-nav:checked ~ .aside-tab .nav-active label, body .layout #aside #tab-toc:checked ~ .aside-tab .toc-active label {
  background-color: rgba(255, 255, 255, 0.9);

}
/* 新增内容7结束 */
/* 新增内容8上部布局调整 */
body .layout #header {
  position: relative;
  width: 92%;
  height: 6rem;
	 padding: 0%;
  max-width: 60rem;
  color: #fff;
  margin-left: auto;
  margin-right: auto;
}
body .layout #header .header__right {
  position: absolute;
  top: 50%;
  margin-top: -1rem;
  right: 0%;
  color: #475671;
  z-index: 99;
}
body .layout #header .logo {
  text-align: center;
}
body .layout #header .logo .fullname {
  margin: 0;
  font-size: 2rem;
}
body .layout #header .logo .fullname a {
  color: #66758c;
  text-decoration: none;
}
/* 新增内容8结束 */
/* 新增内容9 */
body .layout #notes .notes-item .tile-content .article-content {
  width: 0;
  flex: 1;
  overflow: hidden;
}
body .layout #notes .notes-item .tile-content .article-content.w-100 {
     width: 100%;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 4;
    text-overflow: ellipsis;
    white-space: normal;
    display: -webkit-box;
}
body .layout #notes .notes-item .tile-content .article-content:not(.w-100) {
  overflow: hidden;
}
body .layout #notes .notes-item .tile-content .article-content *:last-child {
  margin-bottom: 0;
  vertical-align: bottom;
}
body .layout #notes .notes-item .tile-content .thumbnail {
  width: 7rem;
  height: 5rem;
  object-fit: cover;
  margin-right:.5rem;
}
/* 新增内容9结束 */
/* 新增内容10结束 */
body .layout #comments .comment-list > li.comment .tile-subtitle {
  transition: 300ms;
  padding-top: 8px;
  line-height: 1.7;
}
body .layout #comments .comment-list > li.comment .tile-subtitle:not(:hover) {
  color:#475671;
  padding-top: 8px;
  line-height: 1.7;
}
/* 新增内容10结束 */
/* 新增内容11结束 */
body .layout #footer {
  color: #bcc3ce;
  padding: 5% 4%;
 text-align: center;
 font-size: .7rem;
}
/* 新增内容11结束 */
/* 新增内容12 */
body .flex-wrap {
  flex-wrap: wrap;
    display: flex;
    align-items: flex-start;
    margin-bottom: 0.5rem;
}
/* 新增内容12结束 */
/* 新增内容13 */
.dark body #app.layout #aside .header_nav li:not([class*=current-]),
.dark body #app.layout #aside .footer_nav li:not([class*=current-]) {
  color: var(--wp--preset--color--cyan-bluish-gray);
}
.dark body #app.layout #main {
  color:var(--wp--preset--color--cyan-bluish-gray);}

.dark body .layout #comments .comment-list > li.comment .tile-subtitle:not(:hover) {
    color: var(--wp--preset--color--cyan-bluish-gray);
}

.dark body .layout #comments .comment-list > li.comment .tile-title__name:not(:hover) {
    color: var(--wp--preset--color--cyan-bluish-gray);}
    
.dark .text-gray {
    color: var(--wp--preset--color--cyan-bluish-gray);}

.dark button.btn.btn-link.btn-sm.flex-center {
    color: var(--wp--preset--color--cyan-bluish-gray);}

.dark body .layout #comments .comment-list > li.comment .tile-title__time {
    color:var(--wp--preset--color--cyan-bluish-gray);}

.dark button.btn.btn-link.btn-sm.flex-center:hover {
    color: #eee;
}

.dark blockquote {
    border-left: 4px solid #3A98DC;
    background: #303742;
}

.dark body .layout #notes .chip {
    margin: 0 0.1rem;
    border-radius: 0.1rem;
    background-color: #3b4351;
}
/* 新增内容13结束 */

以上内容包括了底部彩虹等特效,当然有很多是重复的,对于不懂优化的我来说,先这样用着吧。

二、通过WP-China-Yes插件来自定义主题字体

WP-China-Yes以前是一个小团队编辑的小插件,最开始我是为了能优化评论头像cravatar.cn了解到的。后来cravatar.cn被文派收购了,具体脉络不得而知。但是cravatar.cn是真的好用随着Gravatar对国内的不友好,很长一段时间Gravatar都无法显示,后来有了cravatar,头像问题被解决了。

下面我把自定义主页的字体设置方法说一下,以后想接着倒腾了就看看这篇文章。做个备忘。ps.这该死的脑瓜子!

①下载WP-China-Yes插件

文派叶子 🍃(WP-China-Yes)是中国 WordPress 生态基础设施软件,犹如落叶新芽,生生不息。

下载地址:WPCY.com

同时附上文派全家桶我地址:

1、文派开源 → WenPai.org,

2、Cravatar 初认头像 → Cravatar.cn(国内站)→ Cravatar.com(国际站)

3、文派茶馆 → WPTEA.com

4、文风字体Windfonts→ Windfonts.com

5、文派瓦普 → Wapuu.com

②插件设置

插件功能还是很多的就不一一得得了。只说字体这部分:

1、打开WP-China-Yes 设置。

2、选择文风字体。

3、右侧的字体列表选项卡填写对应的字体具体可以自己试试。

4、自定义全局字体

a,p,h1,h2,h3,h4,h5,h6,ul,ol,li,button,blockquote,pre,code,table,th,td,div:not([class<em>="star"]),label,b,i:not([class]),em,small,strong,sub,sup,ins,del,mark,abbr,dfn,span:not([class</em>="icon"])

5、自定义网站logo字体

.layout #header .logo .fullname a

三、未完待续

随着这几天的捣腾,感觉网站又好看了,其实对于一些专业人士,以上操作都太常规了,就像呼吸一样简单,但是对于一个一点网络知识没有的我来说,感觉有些事又变的好玩起来了,就这样吧。上班!

声明:怸歪小站 | 本文采用署名-非商业性使用-相同方式共享 4.0 国际许可协议[CC BY-NC-SA]进行授权
文章名称:【记录】通过添加自定义css修改布局,和利用WP-China-Yes修改字体。
文章链接:https://cycy.fun/2024/12/zdycssxgbj/
本站文章若无特别说明,皆为原创,转载请注明来源:怸歪小站,如果您喜欢可以订阅本站RSS feed
转载声明

  本站资源仅供个人学习交流,请于下载后24小时内删除,不允许用于商业用途,否则法律问题自行承担。如果您访问和下载此文件,表示您同意只将此文件用于参考、学习而非其他用途,否则一切后果请您自行承担。本站为个人博客非盈利性站点,所有软件信息均来自网络,所有资源仅供学习参考研究目的,并不贩卖软件,不存在任何商业目的及用途,网站会员捐赠是您喜欢本站而产生的赞助支持行为,仅为维持服务器的开支与维护,全凭自愿无任何强求。
免责声明
© 2025 怸歪小站
Theme by Wing

辽ICP备2023008417号-1

  • {{ item.name }}
  • {{ item.name }}