博客园新手之美化博客界面

时间:2021-10-07
本文章向大家介绍博客园新手之美化博客界面,主要包括博客园新手之美化博客界面使用实例、应用技巧、基本知识点总结和需要注意事项,具有一定的参考价值,需要的朋友可以参考一下。

一、前言

  喜欢一句话:“任何职业都可以成为黑客。你可以是一个木匠黑客。不一定是高科技。只要与技能有关,并且倾心专注于你正在做的事情,你就可能成为黑客。”我觉得认定要做的事就要尽全力去做好,接下来就通过美化博客来开启自己的博客之旅吧!

二、申请写博功能

  1. 点击头像进入我的园子
  2. 点击写博开通博客功能,理由如实填写,一般两三个小时通过

三、设置博客中的版式

  1. 博客开通后,点击头像——账号设置——博客设置
  2. 选择博客皮肤darkgreentrip后,在页面定制CSS代码中复制以下代码(代码可以根据自己喜好修改参数)然后保存即可
点击查看代码
/* 设置版式 */
#home {
    margin: 0 auto;
    width: 80%;/*原始65*/
    min-width: 980px;/*页面顶部的宽度*/
    background-color: rgba(245, 245, 245, 0.7);
    padding: 30px;
    margin-top: 50px;
    margin-bottom: 50px;
    box-shadow: 0 2px 6px rgba(100, 100, 100, 0.3);
border-radius: 12px;  /*调节边框圆度*/
}
/*boby调节背景图片*/
body {
    background:url("https://images.cnblogs.com/cnblogs_com/nthforsth/1636966/o_2001210816401565149939605.png");  /*背景图片链接*/
    background-position:center left;
    background-size: cover;
    background-repeat: no-repeat;
    background-attachment:fixed;
}
#blogTitle {
    height: 100px;  /*高度/
border-radius: 12px;
    clear: both;
    background-color: #cccccc69;   /*博客标题的背景*/

}
#blogTitle h1 {
    font-size: 36px;
color:#808080;
    font-weight: bold;

    line-height: 1.8em;/*原始 1.6em*/
    margin-top: 10px;/*原始 15px */

}
#blogTitle h2 {
    font-weight: normal;
    font-size: 17px; /*原始 16px ;font-size: 1.0rem;*/
    line-height: 1.8;
    color: #320f9d;
    font-weight: bold;
    text-align: right;
    float: right;
}
#navigator{
border-radius: 7px;
    background-color:rgba(135,206,205, 0.5);          /*标题栏下的颜色*/

}
#navList a:link, #navList a:visited, #navList a:active{
    color: #FFFFFF;
    font-size: 18px;
    font-weight: bold;
}
.blogStats{
    color: #eee;
}
.postTitle {
    border-left: 8px solid rgba(132,112,255, 0);
    margin-left: 10px;
    margin-bottom: 10px;
    font-size: 20px;
    float: right;
    width: 100%;
    clear: both;
}
.postTitle a:link, .postTitle a:visited, .postTitle a:active {
    color:     #FF6A6A;
    transition: all 0.4s linear 0s;
}
.postTitle a:hover {
    margin-left: 30px;
    color: #EE6363;
    text-decoration: none;
}
.postCon {
    float: right;
    line-height: 1.5em;
    width: 100%;
    clear: both;
    padding: 10px 0;
}
.day .postTitle a {
    padding-left: 10px;
}
.day {
    background: rgba(255, 255, 255, 0.5);
}
/*文章附加信息*/
.postDesc {
    background: url(images/posted_time.png) no-repeat 0 1px;
    color: #757575;
    float: left;
    width: 100%;
    clear: both;
    text-align: left;
    font-family: "微软雅黑" , "宋体" , "黑体" ,Arial;
    font-size: 13px;
    padding-right: 20px;/*5px  padding-left: 90px;posted 发表时间左边距离*/
    margin-top: 20px;
    line-height: 1.8;
    padding-bottom: 35px;
}
.newsItem, .catListEssay, .catListLink, .catListNoteBook, .catListTag, .catListPostCategory,
.catListPostArchive, .catListImageCategory, .catListArticleArchive, .catListView,
.catListFeedback, .mySearch, .catListComment, .catListBlogRank, .catList, .catListArticleCategory ,#blog-calendar
{
    background: rgba(255, 255, 255, 0.5);
    margin-bottom: 35px;
    word-wrap: break-word;
}
.CalTitle{
    background: rgba(255, 255, 255, 0);
}
.catListTitle{
    background-color: rgba(255,110,180,0.6);   //栏目的条纹颜色
}
#topics{
    background: rgba(255, 255, 255, 0.5);
}
.c_ad_block{
    display: none;
}
#tbCommentBody{
    width: 100%;
    height: 200px;
    background: rgba(255, 255, 255, 0.5);
}
#q{background: rgba(255, 255, 255, 0);}

.CalNextPrev{background: rgba(255, 255, 255, 0);}

.cnblogs_code{
    background: rgba(255, 255, 255, 0);
}
.cnblogs_code div{
    background: rgba(255, 255, 255, 0);
}
.cnblogs_code_toolbar{
    background: rgba(255, 255, 255, 0);
}
#main{min-width: 640px;}
.entrylist{
    background: rgba(255, 255, 255, 0.5);
}
  1. 效果展示

四、添加动态特效

  1. 在"页脚HTML代码"中复制以下代码
点击查看代码
/* 设置动态特效 */
<script type="text/javascript">
   window.onload = function () {
                var minSize = 10; //最小字体
                var maxSize = 20;//最大字体
                var newOne = 600; //生成雪花间隔
                var flakColor = "#f5f5f5fa"; //雪花颜色
                var flak = $("<div></div>").css({position:"absolute","top":"0px"}).html("✽");//定义一个雪花
                var dhight = $(window).height(); //定义视图高度
                var dw =$(window).width()-80; //定义视图宽度
                setInterval(function(){
                var sizeflak = minSize+Math.random()*maxSize; //产生大小不等的雪花
                var startLeft = Math.random()*dw; //雪花生成是随机的left值
                var startOpacity = 0.7+Math.random()*0.3; //随机透明度
                var endTop= dhight-100; //雪花停止top的位置
                var endLeft= Math.random()*dw; //雪花停止的left位置
                var durationfull = 5000+Math.random()*3000; //雪花飘落速度不同
                flak.clone().appendTo($("body")).css({
                "left":startLeft ,
                "opacity":startOpacity,
                "font-size":sizeflak,
                "color":flakColor
                }).animate({
                "top":endTop,
                "left":endLeft,
                "apacity":0.1
                },durationfull,function(){
                $(this).remove()
                });
                },newOne);
            }
 </script>
<script language="javascript" type="text/javascript">
//生成目录索引列表
function GenerateContentList()
{
    var jquery_h3_list = $('#cnblogs_post_body h3');//如果你的章节标题不是h3,只需要将这里的h3换掉即可
    if(jquery_h3_list.length>0)
    {
        var content = '<a name="_labelTop"></a>';
        content    += '<div id="navCategory">';
        content    += '<p style="font-size:18px"><b>阅读目录</b></p>';
        content    += '<ul>';
        for(var i =0;i<jquery_h3_list.length;i++)
        {
            var go_to_top = '<div style="text-align: right"><a href="#_labelTop">回到顶部</a><a name="_label' + i + '"></a></div>';
            $(jquery_h3_list[i]).before(go_to_top);
            var li_content = '<li><a href="#_label' + i + '">' + $(jquery_h3_list[i]).text() + '</a></li>';
            content += li_content;
        }
        content    += '</ul>';
        content    += '</div>';
        if($('#cnblogs_post_body').length != 0 )
        {
            $($('#cnblogs_post_body')[0]).prepend(content);
        }
    }    
}
GenerateContentList();
</script>

五、设置背景音乐

  1. 登陆网页版的网易云音乐,点击歌曲名或歌单名,然后点击生成外链播放器。

  2. 复制iframe代码

  3. 将上个步骤中所复制的代码,复制到“博客侧边栏公告”中,然后保存。(有的网站不支持iframe可以用embed替换)

六、设置博客文章评论功能

  1. 在“页首HTML代码”中最后添加如下代码
    <link type="text/css" rel="stylesheet" href="https://files.cnblogs.com/files/hafiz/feedback.css">
  2. 在“页脚Html代码”中最后添加如下代码
点击查看代码
/* 设置文章评论功能 */
<script type="text/javascript">
$(function(){
    $('#blogTitle h1').addClass('bounceInLeft animated');
    $('#blogTitle h2').addClass('bounceInRight animated');
    // 删除反对按钮
    $('.buryit').remove();
    initCommentData();
});
function initCommentData() {
    $('.feedbackItem').each(function() {
        var text = $(this).find('.feedbackListSubtitle .layer').text();
        // 将楼层信息放到data里面
        // $(this).find('.blog_comment_body').attr('data-louceng', text.replace(/^#/g, ''));
        if($(this).find('.feedbackListSubtitle .louzhu').length>0) $(this).addClass('myself');
        var avatar = $(this).find('> .feedbackCon > span').html() || 'http://pic.cnitblog.com/face/sample_face.gif';
        $(this).find('> .feedbackCon > .blog_comment_body').append('<img class="user-avatar" src="'+avatar+'"/>')
    });
}

$(document).ajaxComplete(function(event, xhr, settings) {
  // 监听获取评论ajax事件
  if(settings.url.indexOf('/mvc/blog/GetComments.aspx') >= 0) {
    initCommentData();
  }
});
</script>

七、设置博客点赞按钮

  1. 在“页面定制CSS代码”中添加如下CSS代码
点击查看代码
/* 设置博客点赞按钮 */
#div_digg{
  padding: 5px;
  border-radius: 5px;
  position: fixed;
  left: 0;
  bottom: 80px;
  width:80px;
  z-index:100;
}
.diggit{
  background: url(http://images2017.cnblogs.com/blog/894443/201709/894443-20170920105433618-867225449.png) no-repeat;
  width: 60px;
  height: 60px;
}
#div_digg .diggnum{
  position: absolute;
  bottom: -20px;
  left: 6px;
  background: #D0D0D0;
  padding: 2px 0;
  display: block;
  color: #555;
  font-size: 12px;
  text-align: center;
  width: 60px;
  -moz-border-radius: 4px;
  -webkit-border-radius: 4px;
  font-weight: bold;
}
/* 删除反对按钮,有点邪恶了 */
.buryit{
  display: none;
}

八、设置博客文章放回顶端按钮

  1. 在"页面定制CSS代码"中添加如下代码
点击查看代码
/* 定制返回顶部按键 */
#back-to-top {
    background-color: #87cefe;
    bottom: 0;
    box-shadow: 0 0 6px #bdc3c7;
    color: #444444;
    padding: 10px 10px;
    position: fixed;
    right: 50px;
    cursor: pointer;
    border-radius: 30px;
}
  1. 在"页脚Html代码"中添加如下代码(可以将文字改为图片)
    <span id="back-to-top"><a href="#top">返回顶端</a></span>

最后很开心完成了博客中的第一遍笔记,也装饰好了自己的博客界面。还有感谢别人的分享!

原文地址:https://www.cnblogs.com/kxsm/p/15375933.html