博客園--設置本身的樣式

使用博客已經將近兩年,畢業設計也是本身在開源系統的基礎上編寫的一個我的博客系統,因此與博客也有一些緣分javascript

1. 博客對比(博客園VS開源中國)

博客園css

優點:能夠定製化本身博客內容
    劣勢:定製化比較複雜,須要必定的功底

中國開源開源社區html

優點:傻瓜式的添加,不須要爲頁面展現考慮
          markdown語法使用能夠對比參照
    劣勢:比較單一

說白了,若是你以爲本身有必定的前端代碼功底,建議使用博客園,比較偷懶一點的,就使用中國開源社區。我的比較喜歡用markdown語法編寫博客,如今是在中國開源社區編寫內容,而後在兩邊同時發佈。 博客園 中國開源社區前端

2. 博客園定製化

2.1. 進入定製化頁面

輸入圖片說明

2.2. 定製化

2.2.1. 定製化皮膚

darkgreentrip 若是想和個人同樣,皮膚要設置成這個java

2.2.2. 定製化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);
}
body {
    background: rgba(12, 100, 129, 1) url('http://images.cnblogs.com/cnblogs_com/Penn000/1013849/o_123.jpg') fixed no-repeat;
    background-position: 50% 5%; 
    background-size: cover;
}
#blogTitle {
    height: 100px;  /*高度*/
    clear: both;
    background-color: rgba(245, 245, 245, 0);
}
#blogTitle h1 {
    font-size: 36px;
    font-weight: bold;
    line-height: 1.8em;/*原始 1.6em*/
    margin-top: 10px;/*原始 15px */
    color: #548B54;
}
#blogTitle h2 {
    font-weight: normal;
    font-size: 17px;/*原始 16px ;font-size: 1.0rem;*/      
    line-height: 1.8;
    color: #111;
    font-weight: bold;
    text-align: right;
    float: right; 
}
#navigator{
    background-color: rgba(33, 160, 139, 0.9);
}
#navList a:link, #navList a:visited, #navList a:active{
    color: #eee;
    font-size: 18px;
    font-weight: bold;
}
.blogStats{
    color: #eee;
}
.postTitle {
    border-left: 8px solid rgba(33, 160, 139, 0.68);
    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: #21759b;
    transition: all 0.4s linear 0s;
}
.postTitle a:hover {
    margin-left: 30px;
    color: #0f3647;
    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(33, 160, 139, 0.9);
}

#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);}

2.2.3. 自動生成目錄(頁腳html代碼)

<script language="javascript" type="text/javascript">
  
  // 生成目錄索引列表
  // ref: http://www.cnblogs.com/wangqiguo/p/4355032.html
  // modified by: zzq
  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">';
         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">回到頂部</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 += '<p style="font-size:18px"><b>正文</b></p>';
         if($('#cnblogs_post_body').length != 0 )
         {
             $($('#cnblogs_post_body')[0]).prepend(content);
         }
     }   
 
     var qqinfo =  '<p style="color:navy;font-size:12px">討論QQ:1586558083</p>';
     $(mainContent[0]).prepend(qqinfo);
 }
 
 GenerateContentList();
 </script>

3. 建議

對頁面有特殊要求的能夠按F12本身慢慢調試,必定能夠寫出一個很漂亮的定製化博客出來。若是失效的話能夠嘗試申請js的權限,我已經申請審覈經過了。markdown

相關文章
相關標籤/搜索