• 博客园美化样式


    页面定制CSS代码

    
    <!--此处修改主题透明度(主页面)-->
    #home {
        margin: 0 auto;
         65%;
        min- 950px;
        background-color: rgba(255, 255, 255, 0.3);
        padding: 30px;
        margin-top: 50px;
        margin-bottom: 50px;
        box-shadow: 0 2px 6px rgba(100, 100, 100, 0.3);
    }
    
    
    <!--此处自定义背景图片-->
    body {
    background: url(https://c-ssl.duitang.com/uploads/blog/202012/04/20201204132456_5231d.thumb.1000_0.jpg) no-repeat fixed;
        background-size: cover;
    }
    
    
    <!--此处修改主题透明度(侧边栏)-->
    .newsItem, .catListEssay, .catListLink, .catListNoteBook, .catListTag, .catListPostCategory, .catListPostArchive, .catListImageCategory, .catListArticleArchive, .catListView, .catListFeedback, .mySearch, .catListComment, .catListBlogRank, .catList, .catListArticleCategory {
        background: rgba(255, 255, 255, 0);
        margin-bottom: 35px;
        word-wrap: break-word;
    }
    
     <!--此处自定义标题背景色-->
    #cnblogs_post_body h1 {
    background: #265B8A;
    border-radius: 6px 6px 6px 6px;
    color: #FFFFFF;
    font-family: FZShuTi;
    font-size: 23px;
    font-weight: bold;
    height: 25px;
    line-height: 25px;
    margin: 18px 0 !important;
    padding: 12px 0 8px 5px;
    text-shadow: 2px 2px 3px #222222;
    text-align:center;
    margin-bottom: 20px;
    }
    #cnblogs_post_body h2 {
    background-color: #008FC6;
    border-radius: 3px;
    text-align:center;
    color: white;
    text-shadow: 1px 1px 2px #222222;
    padding-left: 15px;
    margin-bottom: 12px;
    }
    #cnblogs_post_body h3 {
    background-color: #51C332;
    border-radius: 3px;
    text-align:center;
    color: white;
    text-shadow: 1px 1px 2px #222222;
    padding: 5px 15px;
    margin-bottom: 10px;
    50%
    }
    
    #cnblogs_post_body h4 {
        background-color: #5bc0de;
        border-radius: 3px;
        text-align:center;
        color: white;
        text-shadow: 1px 1px 2px #222222;
        padding: 5px 15px;
        margin-bottom: 10px;
        25%
    }
    
    code {
    padding: 1px 3px;
    margin: 0 3px;
    background: #ddd;
    border: 1px solid #ccc;
    font-family: Menlo,Monaco,Andale Mono,lucida console,Courier New,monospace;
    word-wrap: break-word;
    font-size: 14px;
    }
    #cnblogs_post_body table {
    text-align: center;
     100%;
    border: 1px solid #dedede;
    margin: 15px 0;
    border-collapse: collapse;
    }
    #cnblogs_post_body table thead tr {
    background: #f8f8f8;
    }
    #cnblogs_post_body table tbody tr:hover {
    background: #efefef;
    }
    /*添加按钮*/
    .cnblogs-markdown pre {
      position: relative;
    }
    .cnblogs-markdown pre > span {
      position: absolute;
      top: 0;
      right: 0;
      border-radius: 2px;
      padding: 0 10px;
      font-size: 12px;
      background: rgba(0, 0, 0, 0.4);
      color: #fff;
      cursor: pointer;
      display:none;
    }
    .cnblogs-markdown pre:hover > span {
      display:block;
    }
    .cnblogs-markdown pre > .copyed {
      background: #67c23a;
    }
    
    

    博客侧边栏公告

    <!--侧边悬浮分享模块-->
    <script>window._bd_share_config={"common":{"bdSnsKey":{},"bdText":"","bdMini":"2","bdMiniList":false,"bdPic":"","bdStyle":"0","bdSize":"16"},"slide":{"type":"slide","bdImg":"6","bdPos":"right","bdTop":"100"},"image":{"viewList":["qzone","tsina","tqq","renren","weixin"],"viewText":"分享到:","viewSize":"16"}};with(document)0[(getElementsByTagName('head')[0]||body).appendChild(createElement('script')).src='http://bdimg.share.baidu.com/static/api/js/share.js?v=89860593.js?cdnversion='+~(-new Date()/36e5)];</script>
    <img src="https://pic.cnblogs.com/avatar/1928644/20210112114902.png" alt="晚风花间寺中人的头像" class="img_avatar" width="150px" style="border-radius:50%">
    

    首页HTML代码

    <script language="javascript" type="text/javascript">
    // 生成目录索引列表
    
    function GenerateContentList()
    {
        var mainContent = $('#cnblogs_post_body');
        var h2_list = $('#cnblogs_post_body h2');//如果你的章节标题不是h2,只需要将这里的h2换掉即可
    
        if(mainContent.length < 1)
            return;
     
        if(h2_list.length>0)
        {
            var content = '<a name="_labelTop"></a>';
            content += '<div id="navCategory" style="color:#152e97;">';
            content += '<p style="font-size:18px;"><b>阅读目录</b></p>';
            content += '<ul>';
            for(var i=0; i<h2_list.length; i++)
            {
                var go_to_top = '<div style="text-align: right;"><a href="#_labelTop" style="color:#f68a33">回到顶部</a><a name="_label' + i + '"></a></div>';
                $(h2_list[i]).before(go_to_top);
                
                var h3_list = $(h2_list[i]).nextAll("h3");
                var li3_content = '';
                for(var j=0; j<h3_list.length; j++)
                {
                    var tmp = $(h3_list[j]).prevAll('h2').first();
                    if(!tmp.is(h2_list[i]))
                        break;
                    var li3_anchor = '<a name="_label' + i + '_' + j + '"></a>';
                    $(h3_list[j]).before(li3_anchor);
                    li3_content += '<li><a href="#_label' + i + '_' + j + '">' + $(h3_list[j]).text() + '</a></li>';
                }
                
                var li2_content = '';
                if(li3_content.length > 0)
                    li2_content = '<li><a href="#_label' + i + '">' + $(h2_list[i]).text() + '</a><ul>' + li3_content + '</ul></li>';
                else
                    li2_content = '<li><a href="#_label' + i + '">' + $(h2_list[i]).text() + '</a></li>';
                content += li2_content;
            }
            content += '</ul>';
            content += '</div><p>&nbsp;</p>';
            content += '<hr style="height:1px;border:none;border-top:1px dashed #0066CC;"/>';
            if($('#cnblogs_post_body').length != 0 )
            {
                $($('#cnblogs_post_body')[0]).prepend(content);
            }
        }   
    }
    
    GenerateContentList();
    </script>
    

    页脚HTML代码

    
    <script language="javascript" type="text/javascript">
    // 生成目录索引列表
    
    function GenerateContentList()
    {
        var mainContent = $('#cnblogs_post_body');
        var h2_list = $('#cnblogs_post_body h2');//如果你的章节标题不是h2,只需要将这里的h2换掉即可
    
        if(mainContent.length < 1)
            return;
    
        if(h2_list.length>0)
        {
            var content = '<a name="_labelTop"></a>';
            content += '<div id="navCategory" style="color:#152e97;">';
            content += '<p style="font-size:18px;"><b style="margin-left: 6px">阅读目录</b></p>';
            content += '<ul>';
            for(var i=0; i<h2_list.length; i++)
            {
                var go_to_top = '<div style="text-align: right;"><a href="#_labelTop" style="color:#f68a33">回到顶部</a><a name="_label' + i + '"></a></div>';
                $(h2_list[i]).before(go_to_top);
    
               var h3_list = $(h2_list[i]).nextAll("h9");  
           // 把“h9”换成“h3”即可正常渲染出 三级索引,此处我是故意不让它渲染出来,因为文章索引多了会显得目录杂乱不美观(跟个人需求改~)
                var li3_content = '';
                for(var j=0; j<h3_list.length; j++)
                {
                    var tmp = $(h3_list[j]).prevAll('h2').first();
                    if(!tmp.is(h2_list[i]))
                        break;
                    var li3_anchor = '<a name="_label' + i + '_' + j + '" style="text-decoration: none"></a>';
                    $(h3_list[j]).before(li3_anchor);
                    li3_content += '<li><a href="#_label' + i + '_' + j + '" style="text-decoration: none">' + $(h3_list[j]).text() + '</a></li>';
                }
    
                var li2_content = '';
                if(li3_content.length > 0)
                    li2_content = '<li><a href="#_label' + i + '" style="text-decoration: none">' + $(h2_list[i]).text() + '</a><ul>' + li3_content + '</ul></li>';
                else
                    li2_content = '<li><a href="#_label' + i + '" style="text-decoration: none">' + $(h2_list[i]).text() + '</a></li>';
                content += li2_content;
            }
            content += '</ul>';
            content += '</div><p>&nbsp;</p>';
            content += '<hr style="height:1px;border:none;border-top:1px dashed #2b542c;"/>';
            if($('#cnblogs_post_body').length != 0 )
            {
                $($('#cnblogs_post_body')[0]).prepend(content);
            }
        }
    }
    
    GenerateContentList();
    
    </script>
    <script src="https://cdn.bootcss.com/clipboard.js/2.0.4/clipboard.min.js"></script>
    <script src="https://blog-static.cnblogs.com/files/wuliytTaotao/cp.js"></script>
    
  • 相关阅读:
    Metabase研究 开源的数据报表
    Redis配置不当致使root被提权漏洞
    一个程序员被骗去养猪
    调度器简介,以及Linux的调度策略
    Linux的内存分页管理
    在地铁11号线上写书
    为什么说“概率”带来一场现代革命?
    快速学习Bash
    用树莓派玩转蓝牙
    树莓派的GPIO编程
  • 原文地址:https://www.cnblogs.com/wanwanyuan/p/14272223.html
Copyright © 2020-2023  润新知