【个人博客网站】博客美化——总篇集

本文最后更新于 about 2 years ago,文中所描述的信息可能已发生改变。

TIP提示

本篇为美化教程的合集(暂未彻底完成)

自定义CSS

参考了安知鱼的方案进行修改 原教程butterfly 重装日记

css
/* 滚动条 */
::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}
::-webkit-scrollbar-track {
  background-color: rgba(73, 177, 245, 0.2);
  border-radius: 2em;
}
::-webkit-scrollbar-thumb {
  background-color: #49b1f5;
  background-image: -webkit-linear-gradient(
    45deg,
    rgba(255, 255, 255, 0.4) 25%,
    transparent 25%,
    transparent 50%,
    rgba(255, 255, 255, 0.4) 50%,
    rgba(255, 255, 255, 0.4) 75%,
    transparent 75%,
    transparent
  );
  border-radius: 2em;
}
::-webkit-scrollbar-corner {
  background-color: transparent;
}
::-moz-selection {
  color: #fff;
  background-color: #49b1f5;
}
  
/* 音乐播放器 */
/* .aplayer .aplayer-lrc {
  display: none !important;
} */ 
.aplayer.aplayer-fixed.aplayer-narrow .aplayer-body {
  left: -66px !important;
  transition: all 0.3s;
  /* 默认情况下缩进左侧66px,只留一点箭头部分 */
}
.aplayer.aplayer-fixed.aplayer-narrow .aplayer-body:hover {
  left: 0 !important;
  transition: all 0.3s;
  /* 鼠标悬停是左侧缩进归零,完全显示按钮 */
}
.aplayer.aplayer-fixed {
  z-index: 999999 !important;
}

/* bilibli番剧插件 */
.bangumi-active {
  background: #dbecfe !important;
  border-radius: 10px !important;
  }
a.bangumi-tab:hover {
  text-decoration: none !important;
}
.bangumi-button:hover {
  background: #dbecfe !important;
  border-radius: 10px !important;
}
a.bangumi-button.bangumi-nextpage:hover {
  text-decoration: none !important;
}
.bangumi-button {
  padding: 5px 10px !important;
}
a.bangumi-tab {
  padding: 5px 10px !important;
}
svg.icon.faa-tada {
  font-size: 1.1em;
}

/*top-img黑色透明玻璃效果移除,不建议加,除非你执着于完全一图流或者背景图对比色明显 */
/* #page-header:not(.not-top-img):before {
    background-color: transparent !important;
  } */

/* 页脚透明 */
#footer {
  background: transparent !important;
}

/* 头图透明 */
#page-header {
  background: transparent !important;
}

/* 鼠标指针 */
/* 全局默认鼠标指针 */
body,html,.post-meta-date{
  cursor: url(/cur/arrow.cur),auto !important;
}
/* 悬停图片时的鼠标指针 */
img{
  cursor: url(/cur/link.cur),auto !important;
}
/* 选择链接标签时的鼠标指针 */
a:hover{
  cursor: url(/cur/link.cur),auto !important;
}
/* 选中输入框时的鼠标指针 */
#veditor,input:hover{
  cursor: url(/cur/input.cur),auto !important;
}
/* 悬停按钮时的鼠标指针 */
button:hover{
  cursor: url(/cur/link.cur),auto !important;
}
.reward-button{
  cursor: url(/cur/link.cur),auto !important;
}
.swiper-pagination-bullet{
  cursor: url(/cur/link.cur),auto !important;
}
#site-name:hover::after{
  cursor: url(/cur/link.cur),auto !important;
}
.vcol.vcol-40.vctrl.text-right>span,
.folding-tag>summary,
#scroll-down{
  cursor: url(/cur/link.cur),auto !important;
}
.toc-item.toc-level-1,
.code-expand-btn,
.code-expand-btn.expand-done{
  cursor: url(/cur/link.cur),auto !important;
}
/* 悬停列表标签时的鼠标指针 */
i:hover{
  cursor: url(/cur/link.cur),auto !important;
}
category-list-item::before{
  cursor: url(/cur/arrow.cur),auto !important;
}
#aside-content .aside-list > .aside-list-item:hover{
  cursor: url(/cur/link.cur),auto !important;
}
/* 悬停页脚链接标签(例如页脚徽标)时的鼠标指针 */
#footer-wrap a:hover{
  cursor: url(/cur/link.cur),auto !important;
}
/* 悬停页码时的鼠标指针 */
#pagination .page-number:hover{
  cursor: url(/cur/btn.cur),auto !important;
}
/* 悬停菜单栏时的鼠标指针 */
#nav .site-page:hover{
  cursor: url(/cur/link.cur),auto !important;
}
/* 音乐播放器 */
.aplayer-pic,
.aplayer-list,
.aplayer-bar,
.aplayer-volume-bar,
.aplayer-volume,
.aplayer-icon,
.aplayer-thumb{
  cursor: url(/cur/link.cur),auto !important;
}
div>div>ol>li{
  cursor: url(/cur/link.cur),auto !important;
}
.aplayer-music{
  cursor: url(/cur/arrow.cur),auto !important;
}

/* 代码框主题 */
#article-container figure.highlight {
  border-radius: 10px;
}

/*哔哩哔哩视频适配*/
.aspect-ratio {position: relative;width: 100%;height: 0;padding-bottom: 75%;margin: 3% auto;text-align: center;}      
.aspect-ratio iframe {
  position: absolute;
  width: 100%;
  height: 100%;
  left: 0;
  top: 0;
}

svg.icon {
  width: 1em; height: 1em;
  /* width和height定义图标的默认宽度和高度*/
  vertical-align: -0.15em;
  fill: currentColor;
  overflow: hidden;
}

/* md网站下划线 */
#article-container a:hover {
  text-decoration: none !important;
}

/* 归档样式 */
span.card-archive-list-count {
  width: auto;
  text-align: left;
  font-size: 1.5rem;
  line-height: 0.9;
  font-weight: 700;
}
.card-archive-list-count-group {
  display: flex;
  flex-direction: row;
  align-items: baseline;
}
#aside-content .card-archives ul.card-archive-list > .card-archive-list-item a span:last-child {
  width: fit-content;
  margin-left: 4px;
}
span.card-archive-list-count {
  width: auto;
  text-align: left;
  font-size: 1.1rem;
  line-height: 0.9;
  font-weight: 700;
}
.card-archive-list-date {
  font-size: 14px;
  opacity: 0.6;
}
li.card-archive-list-item {
  width: 100%;
  flex: 0 0 48%;
}
#aside-content .card-archives ul.card-archive-list > .card-archive-list-item a:hover {
  color: white;
  background-color: #5CA1FF;
  border-color: #5CA1FF;
  box-shadow: 0px 0px 5px #5CA1FF;
  border-radius: 8px;
  padding-left: 0.5rem;
  padding-right: 0.5rem;
}
@media screen and (min-width: 1300px) {
  #aside-content .card-archives ul.card-archive-list > .card-archive-list-item a:hover {
    transform: scale(1.03);
  }
  #aside-content .card-archives ul.card-archive-list > .card-archive-list-item a:active {
    transform: scale(0.97);
  }
}
#aside-content .card-archives ul.card-archive-list > .card-archive-list-item a {
  border-radius: 8px;
  margin: 4px 0;
  display: flex;
  border-style: solid;
  flex-direction: column;
  align-content: space-between;
  border-color: #cdd1e0;
}
#aside-content .card-archives ul.card-archive-list > .card-archive-list-item a span:first-child {
  width: auto;
  flex: inherit;
}
#aside-content .card-archives ul.card-archive-list {
  display: flex;
  flex-direction: row;
  justify-content: space-between;
  flex-wrap: wrap;
}

/* 最新文章样式 */
#aside-content .aside-list > .aside-list-item .content > time {
  display: none;
}
#aside-content .aside-list > .aside-list-item .content > .title {
  -webkit-line-clamp: 3;
  font-weight: 700;
  padding: 2px 0;
}
#aside-content .aside-list > .aside-list-item {
  padding: 8px;
  padding-top: 6px !important;
  padding-bottom: 6px !important;
  border-radius: 12px;
  transition: 0.3s;
  margin: 4px 0;
  cursor: pointer;
}
@media screen and (min-width: 1300px) {
  #aside-content .aside-list > .aside-list-item:hover {
    transform: scale(1.03);
  }
  #aside-content .aside-list > .aside-list-item:active {
    transform: scale(0.97);
  }
}
#aside-content .aside-list > .aside-list-item:hover .thumbnail > img {
  transform: scale(1);
}
#aside-content .aside-list > .aside-list-item:not(:last-child) {
  border-bottom: 0 dashed #5CA1FF !important;
}
#aside-content .aside-list > .aside-list-item .thumbnail {
  border-radius: 8px;
  border: var(--style-border);
}
#aside-content .aside-list > .aside-list-item:hover {
  background: #5CA1FF;
  color: white;
  transition: 0.3s;
  box-shadow: 0px 0px 5px #5CA1FF;
}
#aside-content .aside-list > .aside-list-item:hover a {
  color: white !important;
}
.card-widget.card-recent-post {
  padding: 0.4rem 0.6rem !important;
}

/* 404页面 */
#error-wrap {
  position: absolute;
  top: 40%;
  right: 0;
  left: 0;
  margin: 0 auto;
  padding: 0 1rem;
  max-width: 1000px;
  transform: translate(0, -50%);
}
#error-wrap .error-content {
  display: flex;
  flex-direction: row;
  justify-content: center;
  align-items: center;
  margin: 0 1rem;
  height: 18rem;
  border-radius: 8px;
  background: #5CA1FF;
  box-shadow:  0px 0px 5px #5CA1FF;
  transition: all 0.3s;
}
#error-wrap .error-content .error-img {
  box-flex: 1;
  flex: 1;
  height: 100%;
  border-top-left-radius: 8px;
  border-bottom-left-radius: 8px;
  background-color: #5CA1FF;
  background-position: center;
  background-size: cover;
}
#error-wrap .error-content .error-info {
  box-flex: 1;
  flex: 1;
  padding: 0.5rem;
  text-align: center;
  font-size: 14px;
  font-family: Titillium Web, 'PingFang SC', 'Hiragino Sans GB', 'Microsoft JhengHei', 'Microsoft YaHei', sans-serif;
}
#error-wrap .error-content .error-info .error_title {
  margin-top: -4rem;
  font-size: 9em;
}
#error-wrap .error-content .error-info .error_subtitle {
  margin-top: -3.5rem;
  word-break: break-word;
  font-size: 1.6em;
}
#error-wrap .error-content .error-info a {
  display: inline-block;
  margin-top: 0.5rem;
  padding: 0.3rem 1.5rem;
  background: var(--btn-bg);
  color: var(--btn-color);
}
#body-wrap.error .aside-list {
  display: flex;
  flex-direction: row;
  flex-wrap: nowrap;
  bottom: 0px;
  position: absolute;
  padding: 1rem;
  width: 100%;
  overflow: scroll;
}
#body-wrap.error .aside-list .aside-list-group {
  display: flex;
  flex-direction: row;
  flex-wrap: nowrap;
  max-width: 1200px;
  margin: 0 auto;
}
#body-wrap.error .aside-list .aside-list-item {
  padding: 0.5rem;
}
#body-wrap.error .aside-list .aside-list-item img {
  width: 100%;
  object-fit: cover;
  border-radius: 12px;
}
#body-wrap.error .aside-list .aside-list-item .thumbnail {
  overflow: hidden;
  width: 230px;
  height: 143px;
  background: var(--heo-card-bg);
  display: flex;
}
#body-wrap.error .aside-list .aside-list-item .content .title {
  -webkit-line-clamp: 2;
  overflow: hidden;
  display: -webkit-box;
  -webkit-box-orient: vertical;
  line-height: 1.5;
  justify-content: center;
  align-items: flex-end;
  align-content: center;
  padding-top: 0.5rem;
  color: #5CA1FF;
}
#body-wrap.error .aside-list .aside-list-item .content time {
  display: none;
}

/* 浮动特效 */
.wowpanels {
  transition: all .4s cubic-bezier(.39,.575,.565,1);
  }

/* 页面大小 */
/* 电脑端 */
.layout{
  max-width:1450px;
}
body,html,.post-meta-date{
  font-weight: 700;
}
.recent-posts{
  min-width: 1100px;
}
.layout > #post,#page,#category{
  min-width: 1100px;
}
/* 手机端 */
@media screen and (max-width: 768px) {
  .layout{
    max-width: 100%;
  }
  .recent-posts,#page-header{
    min-width: 100%;
  }
  .layout > #post,#page,#category{
    min-width: 100%;
  }
}

/* 弹窗样式 */
.swal-modal .swal-text {
  font-size: 22px;
  text-align: center;
}

/* 页脚颜色 */
.copyright {
  color: aqua;
}
.framework-info {
  color: aqua;
}
#footer #footer-wrap .framework-info a {
  color: orange;
}

/* 个人卡片渐变色 */
#aside-content > .card-widget.card-info {
  background: linear-gradient(-45deg, #5CA1FF, #031764, #150136, #67044d);
  background-size: 400%;
  box-shadow: 0 0 1px black;
  animation: gradient 15s ease infinite;
  position: relative;
  color: white;
}
.site-data > a .headline,.site-data > a .length-num {
  color: white;
}
#aside-content > .card-widget.card-info > #card-info-btn{
  border-radius: 5px;
  background: #425aef;
}

/* 按钮颜色 */
#rightside #rightside-config-show button{
  background: #425aef;
}
#rightside #rightside-config-hide button{
  background: #425aef;
}
#rightside #rightside-config-hide a{
  background: #425aef;
}

站点动态标题

参考了安知鱼的方案进行修改 原教程butterfly 重装日记

js
//动态标题
var OriginTitile = document.title;
var titleTime;
document.addEventListener('visibilitychange', function () {
  if (document.hidden) {
    //离开当前页面时标签显示内容
    document.title = 'w(゚Д゚)w 不要走!再看看嘛!';
    clearTimeout(titleTime);
  } else {
    //返回当前页面时标签显示内容
    document.title = '♪(^∇^*)欢迎回来!' + OriginTitile;
    //两秒后变回正常标题
    titleTime = setTimeout(function () {
      document.title = OriginTitile;
    }, 1000);
  }
});

加载渐变条

原教程butterfly 重装日记

引入以下css

css
.pace {
    -webkit-pointer-events: none;
    pointer-events: none;
    -webkit-user-select: none;
    -moz-user-select: none;
    user-select: none;
    z-index: 2000;
    position: fixed;
    margin: auto;
    top: 10px;
    left: 0;
    right: 0;
    height: 8px;
    border-radius: 8px;
    width: 4rem;
    background: #eaecf2;
    border: 1px #e3e8f7;
    overflow: hidden
}

.pace-inactive .pace-progress {
    opacity: 0;
    transition: .3s ease-in
}

.pace .pace-progress {
    -webkit-box-sizing: border-box;
    -moz-box-sizing: border-box;
    -ms-box-sizing: border-box;
    -o-box-sizing: border-box;
    box-sizing: border-box;
    -webkit-transform: translate3d(0, 0, 0);
    -moz-transform: translate3d(0, 0, 0);
    -ms-transform: translate3d(0, 0, 0);
    -o-transform: translate3d(0, 0, 0);
    transform: translate3d(0, 0, 0);
    max-width: 200px;
    position: absolute;
    z-index: 2000;
    display: block;
    top: 0;
    right: 100%;
    height: 100%;
    width: 100%;
    background: linear-gradient(-45deg, #ee7752, #e73c7e, #23a6d5, #23d5ab);
    animation: gradient 1.5s ease infinite;
    background-size: 200%
}

.pace.pace-inactive {
    opacity: 0;
    transition: .3s;
    top: -8px
}

@keyframes gradient {
    0% {
        background-position: 0% 50%;
    }

    50% {
        background-position: 100% 50%;
    }

    100% {
        background-position: 0% 50%;
    }
}

修改[Blogroot]\_config.butterfly.yml的inject配置项

yaml
inject:
  head:
    - <script data-pjax src="//npm.elemecdn.com/[email protected]/pace.min.js"></script>
  bottom:

文章链接转码

shell
npm install hexo-abbrlink --save

在hexo配置文件或主题配置文件中添加

yaml
abbrlink:
  alg: crc32   #算法: crc16(default) and crc32
  rep: hex    #进制: dec(default) and hex: dec #输出进制:十进制和十六进制,默认为10进制。丨dec为十进制,hex为十六进制

文章双栏

shell
npm install hexo-butterfly-article-double-row --save

在hexo配置文件或主题配置文件中添加

yaml
butterfly_article_double_row:
  enable: true
【个人博客网站】博客美化(五):评论系统以及通知邮件
【个人博客网站】博客美化(四):加入看板娘