博客園自定義樣式主題 -- cnblogs theme


博客園自定義樣式主題

不得不說,博客園自帶的主題的樣式都很一般,不過好在提供了自定義接口,所以就折騰一番吧。

首先選擇基礎的主題(我的是red_autumnal_leaves),否則全部自己寫工作量還是不小的。

可以通過F12查看主題自帶的基礎樣式,然后在此基礎上修改並保存下來。

1. 子標題

子標題想定義成鏈接,so,點擊管理、設置、子標題 填寫如下內容:

<a href="https://github.com/b4zinga" target="_blank">https://github.com/b4zinga</a>

以下【2 - 13】都是最終寫在 管理、設置、頁面定制css代碼
完整代碼詳見github https://github.com/b4zinga/PythonTools/blob/master/cnblogs%20theme.css

2. 導航欄

/*******************博客導航欄 *********************/
#navList {
    float: left;
}

#navList li {
    border: none;
    font-size: 16px;
}

.blogStats {
    display: none;
}

3. 文章主體樣式


/************** 主體內容樣式 ***********************/
.postBody {
    padding: 20px 40px;
}

#cnblogs_post_body {
    font-size: 15px;
}

#cnblogs_post_body h2 {
    /*標題h2*/
    border-left: 5px solid #FF3300;
    padding: 10px 20px;
    line-height: 2;
    background: #d6dbdf8a;
    margin: 30px 0;
    font-size: 25px;
}

#cnblogs_post_body h3 {
    margin: 20px 0;
    padding: 10px 20px;
    border-left: 5px solid #FF3300;
    font-size: 20px;
}

#cnblogs_post_body h4{
    font-size: 18px;
    margin: 20px 0;
}

4. 引言樣式

/********************************引言樣式*****************************/
blockquote {
    border-left: 5px solid #FF3300;
}

blockquote strong {
    color: red;
    font-size: 18px;
}

5. 代碼不換行

pre {
    /*控制代碼不換行*/
    white-space: pre;
    word-wrap: normal;
}

6. 個性簽名

/******************* 個性簽名 ****************************/
#MySignature {
    box-shadow: 8px 1px 10px #989898;
    padding: 10px;
    text-shadow: 1px 1px 1px #FFF;
    font-size: 17px;
    border-left: solid 5px #FF3300;
    background: #F3F3F3;
    border-radius: 10px 10px 50% 10px;
    line-height: 2.4;
    margin: 40px 0;
}

#MySignature a {
    text-decoration: none;
    color: #4183c4;
    font-weight: bold;
}

#MySignature a:hover {
    text-decoration: underline;
    color: #f60;
}

#MySignature span {
    color: #f60;
}

7. 上一篇和下一篇

/********************** 上一篇下一篇 *************************/
#post_next_prev {
    font-size: 14px;
    color: #535353;
}

8. 評論

/************************評論********************************/
/*評論列表*/
#blog-comments-placeholder {
    border-radius: 10px;
    background: #fff;
    padding: 30px 40px;
}

.feedback_area_title {
    background: url(//www.cnblogs.com/skins/red_autumnal_leaves/images/titlebg.png) no-repeat left center #fff;
    border: 1px solid #FF3300;
    border-left-width: 5px;
    border-radius: 10px;
    border-right-width: 5px;
    padding: 15px 50px;
}

9. 提交按鈕

/******************** 提交評論按鈕 *******************************/
#btn_comment_submit {
    border: solid 1px #fd6d0dd1 !important;
    width: 90px;
    height: 40px;
    color: #fff !important;
    background-color: #fd6d0dd1 !important;
    border-radius: 5px;
    font-size: 16px;
    cursor: pointer;
}

10. 隱藏廣告和搜索框

/********************隱藏廣告******************************/
#ad_t2, #cnblogs_c1, #under_post_news, #cnblogs_c2, #under_post_kb {
    display: none;
}
/*******************隱藏搜索框*****************************/
#widget_my_google, #google_q{
    display: none;
}

11. 側邊欄公告

/*****************************側邊欄公告***********************/
#blog-news > img {
    /*頭像*/
    display: block;
    margin: auto;
    border-radius: 50%;
}

#profile_block {
    font-size: 15px;
    padding: 20px;
    line-height: 1.8;
}

#profile_block > a:link {
    color: #F60;
}
/*公告結束*/

12 . 側邊評論

/****************************側邊評論**********************************/
li.recent_comment_body {
    line-height: 30px;
}

13. 側邊欄樣式

/**********************sideBar博客側邊欄容器**********************************/
#sideBarMain h3, .newsItem h3 {
    font-size: 1.2em;
    height: 50px;
    line-height: 50px;
    text-indent: 0.5em;
    background: url(http://www.cnblogs.com/skins/red_autumnal_leaves/images/titlebg.png) no-repeat left center #fff;
    padding: 0 0 0 50px;
    margin-bottom: 0;
    border: 1px solid #FF3300;
    border-left-width: 5px;
    border-radius: 10px;
    border-right-width: 5px;
}
.newsItem, .catListComment, .catListEssay, .catListView, .catListFeedback,
#blog-calendar, #sidebar_postcategory, #sidebar_postcategory, #sidebar_postarchive, #sidebar_search {
    border-radius: 10px;
    box-shadow: 1px 2px 3px #A7A8AD;
    background-color: #fff;
}
#sideBarMain ul {
    background-color: #fff;
    padding: 15px 20px;
    border-bottom-left-radius: 10px;
    border-bottom-right-radius: 10px;
}

#sideBarMain li {
    line-height: 40px;
    border-bottom: 1px solid #ddd;
    font-size: 14px;
}

以上【2 - 13】都是最終寫在 管理、設置、頁面定制css代碼
完整代碼詳見github https://github.com/b4zinga/PythonTools/blob/master/cnblogs%20theme.css

14. 公告板頭像

管理、設置、博客側邊欄公告:

<img src="https://pic.cnblogs.com/avatar/1346826/20180320230642.png">

15. 簽名

管理、博客簽名:

GitHub:<a href="https://github.com/b4zinga" target="_blank">https://github.com/b4zinga</a><br>
 博客園 : <a href="http://www.cnblogs.com/0x4D75/" target="_blank">http://www.cnblogs.com/0x4D75/</a>

配置中個人信息相關配置請酌情修改。

2. 最終結果

最終的結果也就是像本篇博客這個效果啦

本人對CSS可以說是一竅不通的,本次配置主要是網上一通參考,再綜合個人多次嘗試,經過一番增刪改查,最終完成本次配置,總體來是還算比較滿意。

3. Reference

2018 吳煜倫比的瘋丫頭 http://www.cnblogs.com/real-me/p/8336741.html


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM