经验首页 前端设计 程序设计 Java相关 移动开发 数据库/运维 软件/图像 大数据/云计算 其他经验
当前位置:技术经验 » 其他 » 职业生涯 » 查看文章
通过博客园(cnblogs)设置功能定制/自定义样式,简洁化页面展示模块
来源:cnblogs  作者:莫忘归  时间:2021/5/6 17:45:30  对本文有异议

1. 模板选择

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

园主选的模板:LessIsMoreRight

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

2. 自定义样式

2.1 模块介绍

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

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

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

2.2 页面定制 CSS 代码

园主本人代码如下:

  1. .github-corner:hover .octo-arm {
  2. animation: octocat-wave 560ms ease-in-out
  3. }
  4. @keyframes octocat-wave {
  5. 0%,
  6. 100% {
  7. transform: rotate(0)
  8. }
  9. 20%,
  10. 60% {
  11. transform: rotate(-25deg)
  12. }
  13. 40%,
  14. 80% {
  15. transform: rotate(10deg)
  16. }
  17. }
  18. @media (max-width:500px) {
  19. .github-corner:hover .octo-arm {
  20. animation: none
  21. }
  22. .github-corner .octo-arm {
  23. animation: octocat-wave 560ms ease-in-out
  24. }
  25. }
  26. #page_begin_html .back-to-top {
  27. left: unset!important;
  28. right: 304px!important;
  29. height: 850px!important;
  30. background: url(https://blog-static.cnblogs.com/files/fsh001/scroll.gif) 0px 850px;
  31. }
  32. #blogTitle .title {
  33. font-size: 17pt;
  34. text-align: center;
  35. }
  36. .CalTodayDay {
  37. background-color: rgb(0,191,255)!important;
  38. color: white!important;
  39. }
  40. .input_my_zzk {
  41. width: 169px;
  42. vertical-align: middle;
  43. height: 20px;
  44. }
  45. #navigator #navList #nav_sitehome {margin-left: 35px;}
  46. #navigator #navList #nav_myhome {margin-left: 75px;}
  47. #navigator #navList #nav_newpost {margin-left: 22px;}
  48. #navigator #navList #nav_contact {margin-left: 22px;}
  49. #navigator #navList #nav_rss {margin-left: 22px;}
  50. #navigator #navList #nav_admin {margin-left: 22px;}
  51. .blogStats {margin-right: 66px;}
  52. #blogTitle .subtitle {text-align: center;}
  53. #blogTitle {padding: 5px;}
  54. #p_b_follow a {color:red}
  55. #post_detail {margin-left: 207px;}
  56. #post_detail .postTitle {
  57. text-align: center;
  58. font-size: 14pt;
  59. margin: 12px 0px 10px;
  60. }
  61. #ad_t2 {display: none;}
  62. #opt_under_post {display: none;}
  63. .under-post-card, #under_post_card1, #under_post_card2 {display: none;}
  64. #post_detail .postBody .toc {
  65. position: fixed;
  66. width: 230px;
  67. top: 156px;
  68. left: 0px;
  69. border-right: 1px solid #ccc;
  70. border-top: 1px solid #ccc;
  71. border-bottom: 1px solid #ccc;
  72. padding: 20px 4px 20px 6px;
  73. overflow-y: auto;
  74. height: 500px;
  75. scrollbar-width: thin;
  76. }
  77. /*定义滚动条高宽及背景 高宽分别对应横竖滚动条的尺寸*/
  78. #post_detail .postBody .toc::-webkit-scrollbar {
  79. width: 6px;
  80. height: 6px;
  81. background-color: #fff;
  82. }
  83. /*定义滚动条轨道 内阴影+圆角*/
  84. #post_detail .postBody .toc::-webkit-scrollbar-track {
  85. -webkit-box-shadow: inset 0 0 2px rgba(0,0,0,0.3);
  86. border-radius: 3px;
  87. background-color: #F5F5F5;
  88. }
  89. /*定义滑块 内阴影+圆角*/
  90. #post_detail .postBody .toc::-webkit-scrollbar-thumb {
  91. border-radius: 3px;
  92. -webkit-box-shadow: inset 0 0 2px rgba(0,0,0,.3);
  93. background-color: lightgray;
  94. }
  95. #sideBar {
  96. width: 236px;
  97. padding: 0px 6px 20px 9px;
  98. top: 156px;
  99. }
  100. .blogStats {margin-right: 4px;}
  101. #page_begin_html .back-to-top {right: 217px !important;}
  102. #mainContent {margin-right: 244px;}
  103. .forFlow {margin: 0 33px 0 50px;}
  104. #post_detail .postBody .toc .toc-container-header {font-weight: bolder;}
  105. #post_detail .postBody .toc ul {margin-left: 22px;}
  106. #post_detail .postBody .toc ul li a {text-decoration: none; }
  107. .day .postTitle {font-size: 14pt;}
  108. .comment_textarea {width: auto;}
  109. div.commentform textarea {height: 200px;}
  110. #commentbox_opt input[type="button"] {
  111. color: white;
  112. background-color: #06c;
  113. }
  114. #blogTitle .title #chenghao {
  115. font-size: 8pt;
  116. color: #999;
  117. }
  118. #blogTitle .title a:hover {color: #f00 !important;}
  119. #blogTitle .subtitle a {color: #999;}
  120. #blogTitle .subtitle a:hover {color: #f00;}

2.3 页首 HTML 代码

园主本人代码如下:

  1. <!-- github跳转链接模块 -->
  2. <a href="https://github.com/lishen2020" target="_blank" class="github-corner">
  3. <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">
  4. <path d="M0,0 L115,115 L130,115 L142,142 L250,250 L250,0 Z"></path>
  5. <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>
  6. <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>
  7. <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">
  8. <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>
  9. </a>
  10. <!-- 悬挂的喵 -->
  11. <script type="text/javascript" src="https://blog-static.cnblogs.com/files/fsh001/szgotop.js"></script>
  12. <link rel="stylesheet" type="text/css" href="https://blog-static.cnblogs.com/files/fsh001/szgotop.css" />
  13. <div class="back-to-top cd-top faa-float animated cd-is-visible" style="top: -999px;"></div>
  14. <script type="text/javascript">
  15. $(function(){
  16. $(".navbar-custom").css("display", "block");
  17. navHeader();
  18. $(window).scroll(function () {
  19. navHeader();
  20. changeColor();
  21. })
  22. function navHeader() {
  23. if ($(window).scrollTop() > 100) {
  24. $(".octicon1").css("display", "block");
  25. $(".octicon").css("display", "none");
  26. } else {
  27. $(".octicon").css("display", "block");
  28. $(".octicon1").css("display", "none");
  29. }
  30. }
  31. // 改变悬浮块猫头的填充颜色
  32. function changeColor() {
  33. $(".octo-body1").css("fill", randomHexColor());
  34. }
  35. // 生成随机色值
  36. function randomHexColor() {
  37. return '#' + ('00000' + (Math.random() * 0x1000000 << 0).toString(16)).substr(-6);
  38. }
  39. })
  40. // 标题设置
  41. var chenghao = "<a id='chenghao' href='https://baike.baidu.com/item/程颢/1453707' target='_blank'> 北宋 程颢(1032年~1085年)</a>";
  42. $("#blogTitle .title").append(chenghao);
  43. </script>
  44. <!-- 鼠标点击特效 -->
  45. <script src="https://blog-static.cnblogs.com/files/hunternet/cursor-effects.js"></script>

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

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

原文链接:http://www.cnblogs.com/lishen2021/p/14678015.html

 友情链接:直通硅谷  点职佳  北美留学生论坛

本站QQ群:前端 618073944 | Java 606181507 | Python 626812652 | C/C++ 612253063 | 微信 634508462 | 苹果 692586424 | C#/.net 182808419 | PHP 305140648 | 运维 608723728

W3xue 的所有内容仅供测试,对任何法律问题及风险不承担任何责任。通过使用本站内容随之而来的风险与本站无关。
关于我们  |  意见建议  |  捐助我们  |  报错有奖  |  广告合作、友情链接(目前9元/月)请联系QQ:27243702 沸活量
皖ICP备17017327号-2 皖公网安备34020702000426号