通过博客园(cnblogs)设置功能定制/自定义样式,简洁化页面展示模块

1. 模板选择

  注册登录博客园后,通过右上角头像下的 我的博客 进入自己的博客主页,找到 管理 进入后台管理页,选 设置 标签,找到 “博客皮肤” 选择喜欢的皮肤模板。

园主选的模板:LessIsMoreRight

选择并使用模板后保存设置即可使用,如果对样式布局不满意,博客园提供了自定义样式功能,可以进行样式的自定义。

2. 自定义样式

2.1 模块介绍

还是进入设置模板的地方,设置项下面分几块可以通过自定义的HTML和CSS实现样式的自定义化。共分为以下四个模块:

  • 页面定制 CSS 代码
  • 博客侧边栏公告(支持HTML代码) (支持 JS 代码)
  • 页首 HTML 代码
  • 页脚 HTML 代码

通过这几个模块根据自己的喜好实现自定义化。

2.2 页面定制 CSS 代码

园主本人代码如下:

.github-corner:hover .octo-arm {
    animation: octocat-wave 560ms ease-in-out
}
@keyframes octocat-wave {
    0%,
    100% {
        transform: rotate(0)
    }
    20%,
    60% {
        transform: rotate(-25deg)
    }
    40%,
    80% {
        transform: rotate(10deg)
    }
}
@media (max-width:500px) {
    .github-corner:hover .octo-arm {
        animation: none
    }
    .github-corner .octo-arm {
        animation: octocat-wave 560ms ease-in-out
    }
}

#page_begin_html .back-to-top {
    left: unset!important;
    right: 304px!important;
    height: 850px!important;
    background: url(https://blog-static.cnblogs.com/files/lishen2021/scroll.gif) 0px 850px;
}
#blogTitle .title {
    font-size: 17pt;
    text-align: center;
}
.CalTodayDay {
    background-color: rgb(0,191,255)!important;
    color: white!important;
}
.input_my_zzk {
    width: 169px;
    vertical-align: middle;
    height: 20px;
}

#navigator #navList #nav_sitehome {margin-left: 35px;}
#navigator #navList #nav_myhome {margin-left: 75px;}
#navigator #navList #nav_newpost {margin-left: 22px;}
#navigator #navList #nav_contact {margin-left: 22px;}
#navigator #navList #nav_rss {margin-left: 22px;}
#navigator #navList #nav_admin {margin-left: 22px;}
.blogStats {margin-right: 66px;}
#blogTitle .subtitle {text-align: center;}
#blogTitle {padding: 5px;}
#p_b_follow a {color:red}

#post_detail {margin-left: 207px;}
#post_detail .postTitle {
    text-align: center;
    font-size: 14pt;
    margin: 12px 0px 10px;
}
#ad_t2 {display: none;}
#opt_under_post {display: none;}
.under-post-card, #under_post_card1, #under_post_card2 {display: none;}
#post_detail .postBody .toc {
    position: fixed;
    width: 230px;
    top: 156px;
    left: 0px;
    border-right: 1px solid #ccc;
    border-top: 1px solid #ccc;
    border-bottom: 1px solid #ccc;
    padding: 20px 4px 20px 6px;
    overflow-y: auto;
    height: 500px;
    scrollbar-width: thin;
}
/*定义滚动条高宽及背景 高宽分别对应横竖滚动条的尺寸*/
#post_detail .postBody .toc::-webkit-scrollbar {
    width: 6px;
    height: 6px;
    background-color: #fff;
}
/*定义滚动条轨道 内阴影+圆角*/
#post_detail .postBody .toc::-webkit-scrollbar-track {
    -webkit-box-shadow: inset 0 0 2px rgba(0,0,0,0.3);
    border-radius: 3px;
    background-color: #F5F5F5;
}
/*定义滑块 内阴影+圆角*/
#post_detail .postBody .toc::-webkit-scrollbar-thumb {
    border-radius: 3px;
    -webkit-box-shadow: inset 0 0 2px rgba(0,0,0,.3);
    background-color: lightgray;
}
#sideBar {
    width: 236px;
    padding: 0px 6px 20px 9px;
    top: 156px;
}
.blogStats {margin-right: 4px;}
#page_begin_html .back-to-top {right: 217px !important;}
#mainContent {margin-right: 244px;}
.forFlow {margin: 0 33px 0 50px;}
#post_detail .postBody .toc .toc-container-header {font-weight: bolder;}
#post_detail .postBody .toc ul {margin-left: 22px;}
#post_detail .postBody .toc ul li a {text-decoration: none; }
.day .postTitle {font-size: 14pt;}
.comment_textarea {width: auto;}
div.commentform textarea {height: 200px;}
#commentbox_opt input[type="button"] {
    color: white;
    background-color: #06c;
}
#blogTitle .title #chenghao {
    font-size: 8pt;
    color: #999;
}
#blogTitle .title a:hover {color: #f00 !important;}
#blogTitle .subtitle a {color: #999;}
#blogTitle .subtitle a:hover {color: #f00;}

2.3 页首 HTML 代码

园主本人代码如下:

<!-- github跳转链接模块 -->
<a href="https://github.com/lishen2020" target="_blank" class="github-corner">
    <svg class="octicon" width="65" height="65" viewBox="0 0 250 250" style="fill:#151513; color:#fff; position: absolute; border: 0; right: 0; transform: scale(1, 1);" aria-hidden="true">
      <path d="M0,0 L115,115 L130,115 L142,142 L250,250 L250,0 Z"></path>
      <path d="M128.3,109.0 C113.8,99.7 119.0,89.6 119.0,89.6 C122.0,82.7 120.5,78.6 120.5,78.6 C119.2,72.0 123.4,76.3 123.4,76.3 C127.3,80.9 125.5,87.3 125.5,87.3 C122.9,97.6 130.6,101.9 134.4,103.2" fill="currentColor" style="transform-origin: 130px 106px;" class="octo-arm"></path>
      <path d="M115.0,115.0 C114.9,115.1 118.7,116.5 119.8,115.4 L133.7,101.6 C136.9,99.2 139.9,98.4 142.2,98.6 C133.8,88.0 127.5,74.4 143.8,58.0 C148.5,53.4 154.0,51.2 159.7,51.0 C160.3,49.4 163.2,43.6 171.4,40.1 C171.4,40.1 176.1,42.5 178.8,56.2 C183.1,58.6 187.2,61.8 190.9,65.4 C194.5,69.0 197.7,73.2 200.1,77.6 C213.8,80.2 216.3,84.9 216.3,84.9 C212.7,93.1 206.9,96.0 205.4,96.6 C205.1,102.4 203.0,107.8 198.3,112.5 C181.9,128.9 168.3,122.5 157.7,114.1 C157.9,116.9 156.7,120.9 152.7,124.9 L141.0,136.5 C139.8,137.7 141.6,141.9 141.8,141.8 Z" fill="currentColor" class="octo-body"></path></svg>

   <svg class="octicon1" height="38"  width="38" viewBox="0 0 16 16" version="1.1" style="position: fixed; top: 0.5px; border: 0; right: 0.5px; transform: scale(1, 1); z-index:999" aria-hidden="true" display="none">
<path fill-rule="evenodd" d="M8 0C3.58 0 0 3.58 0 8c0 3.54 2.29 6.53 5.47 7.59.4.07.55-.17.55-.38 0-.19-.01-.82-.01-1.49-2.01.37-2.53-.49-2.69-.94-.09-.23-.48-.94-.82-1.13-.28-.15-.68-.52-.01-.53.63-.01 1.08.58 1.23.82.72 1.21 1.87.87 2.33.66.07-.52.28-.87.51-1.07-1.78-.2-3.64-.89-3.64-3.95 0-.87.31-1.59.82-2.15-.08-.2-.36-1.02.08-2.12 0 0 .67-.21 2.2.82.64-.18 1.32-.27 2-.27.68 0 1.36.09 2 .27 1.53-1.04 2.2-.82 2.2-.82.44 1.1.16 1.92.08 2.12.51.56.82 1.27.82 2.15 0 3.07-1.87 3.75-3.65 3.95.29.25.54.73.54 1.48 0 1.07-.01 1.93-.01 2.2 0 .21.15.46.55.38A8.013 8.013 0 0016 8c0-4.42-3.58-8-8-8z" class="octo-body1"></path></svg>
</a>

<!-- 悬挂的喵 -->
<script type="text/javascript" src="https://blog-static.cnblogs.com/files/lishen2021/szgotop.js"></script>
<link rel="stylesheet" type="text/css" href="https://blog-static.cnblogs.com/files/lishen2021/szgotop.css" />
<div class="back-to-top cd-top faa-float animated cd-is-visible" style="top: -999px;"></div>


<script type="text/javascript">
	$(function(){
		$(".navbar-custom").css("display", "block");

		navHeader();
		$(window).scroll(function () {
			navHeader();
			changeColor();
		})
		function navHeader() {
			if ($(window).scrollTop() > 100) {
				$(".octicon1").css("display", "block");
				$(".octicon").css("display", "none");
			} else {
				$(".octicon").css("display", "block");
				$(".octicon1").css("display", "none");
			}
		}
		// 改变悬浮块猫头的填充颜色
		function changeColor() {
			$(".octo-body1").css("fill", randomHexColor());
		}
		// 生成随机色值
		function randomHexColor() {
			return '#' + ('00000' + (Math.random() * 0x1000000 << 0).toString(16)).substr(-6);
		}
	})
	// 标题设置
	var chenghao = "<a id='chenghao' href='https://baike.baidu.com/item/程颢/1453707' target='_blank'> 北宋 程颢(1032年~1085年)</a>";
    $("#blogTitle .title").append(chenghao);
</script>

<!-- 鼠标点击特效 -->
<script src="https://blog-static.cnblogs.com/files/lishen2021/cursor-effects.js"></script>

至此,园主本人通过 页面定制 CSS 代码页首 HTML 代码 两个自定义模块实现了目前的样式。

如果你想要更舒服的样式,可以通过对页首、页脚以及侧边栏的自定义化来具体实现。

posted @ 2021-04-19 18:11  莫忘归  阅读(804)  评论(0编辑  收藏  举报