博客園自定義樣式

碎碎念:html

  • 已經很長時間沒有更新過博客了,分析一下,一個是太懶了。。。因此好久沒整理一下了。
  • 還有就是嫌棄博客園默認的博客界面真的太醜了,做爲顏控的我真的沒法忍受啊。
  • 我的比較喜歡用makedown來編寫博客,可是博客園自帶的編輯器真的不是很友好啊。。。。。

還好,博客園比較人性化的有頁面樣式的自定製功能。爲了裝修個人博客,斷斷續續用了三、4天的時間(效率過低了),經過參考了一些博客以後,作了一下整理。git

小提示:
  可能博客中的代碼與如今的樣式有點差別,那是由於以後有作過樣式的調整,具體代碼參考GitHubhttps://github.com/RealAndMe/blogs-stylegithub

1. 基礎介紹

1-1. 介紹一下個人博客設置

  1. 我我的比較習慣用 Makedown 來編寫,因此我選擇的編輯器是 Makedown,在 [ 管理 ] - [ 選項 ] 中能夠設置。
  2. [ 管理 ] - [ 模版 ] 中有許多博客模板,能夠直接使用,界面也會變好看一點。我使用的是 red_autumnal_leaves (紅葉)
  3. 由於個人樣式定製是在紅葉的模版基礎上進行修改的,因此可能其餘的模版會出現兼容的問題,這個能夠根據本身的模版和喜愛進行修改。(我已經儘可能作到樣式兼容了,可是模版太多,愛莫能助啊。。。)

1-2. 簡單的操做

能夠經過審查元素的方法,來設置本身滿意的樣式。操做是F12
F12操做能夠打開控制面板,具體的樣式能夠直接在上面修改,而後把修改後的樣式保存下來。編輯器

控制面板

保存後的樣式,複製到[ 管理 ] - [ 設置 ] - 頁面定製CSS代碼上面,而後[ 保存 ]ide

注意:
有時候修改的樣式沒有起做用,是由於樣式的優先級的緣由,這裏我選擇簡單粗暴的!important來解決post

2. 設置標題、子標題、導航欄

2-1. 標題和子標題

標題和子標題 是頁面最頂部的,設置在 [ 管理 ] - [ 設置 ] - 標題,子標題字體

/* 博客標題和副標題 */
#blogTitle {
    overflow: hidden;
    height: auto;
    text-align: center;
}

#blogTitle h1 {
    font-size: 35px;
    width: 100%;
    margin-left: 0;
}

#blogTitle h2 {
    margin-left: 0;
    width: 100%;
    font-size: 20px;
    font-weight: bold;
    color: #000;
}

2-2. 博客頂部的導航欄

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

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

.blogStats {
    display: none;
}

3. 設置博客側邊欄

3-1. 側邊欄總體公共樣式

/*sideBar博客側邊欄容器*/
#sideBar {
    width: 300px;
    box-sizing: border-box;
    margin-left: 30px;
    padding: 0;
}

.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 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 #55895B;
    border-left-width: 5px;
    border-radius: 10px;
    border-right-width: 5px;
}

/*側邊欄列表樣式*/
#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;
}

3-2. 側邊欄公告

3-3. 頭像設置

[ 管理 ] - [ 設置 ] - 博客側邊欄公告 這裏添加 html 代碼,用來添加頭像,地址用本身的頭像flex

//圖片的地址更換成你的頭像的地址
<img src="https://cnblogspic.oss-cn-hangzhou.aliyuncs.com/avatar/937605/20180122200140.png">

3-4. 側邊欄公告樣式

/*側邊欄公告*/
#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;
}

/*公告結束*/

3. 側邊欄日曆

/* 日曆 */
#blog-calendar, #calendar {
    width: 300px;
}

#blog-calendar td {
    padding: 5px 3px;
    font-size: 14px;
}

#blog-calendar td a {
    font-weight: bold;
    color: #59a020;
}

#blog-calendar table a:hover {
    color: #59a020;
    text-decoration: underline;
    background: transparent;
}

#blog-calendar table u {
    text-decoration: none;
}

/*日曆結束*/

4. 側邊欄搜索框

/*側邊搜索框*/
.mySearch {
    padding-bottom: 10px;
}

.mySearch > div {
    padding-top: 10px
}

.mySearch #q {
    height: 40px;
    width: 150px;
    border-radius: 5px;
    border: 1px solid #ddd;
}

.mySearch #btnZzk {
    height: 42px;
    width: 90px;
    background: #fd6d0dd1;
    color: #fff;
    border-radius: 5px;
    border: none;
    font-size: 15px;
    cursor: pointer;
}

.div_my_zzk {
    padding: 0 20px;
    display: flex;
    justify-content: space-around;
}

/*搜索框結束*/

4. 評論列表

碎碎念:url

由於我更新博客的頻率不多,並且質量還不是很高,因此評論也就不多。。。因此目前的評論列表樣式是這樣的,若是以後有更多的評論,那麼還會繼續修改樣式的,畢竟我是一個顏控啊!!
  spa

4-1. 底部評論表

/*評論*/
/*評論列表*/
#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 #55895B;
    border-left-width: 5px;
    border-radius: 10px;
    border-right-width: 5px;
    padding: 15px 50px;
}
/* 提交評論按鈕 */
#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;
}

4-2. 側邊欄評論

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

5. 個性簽名

個性簽名 這個是根據我的的喜愛設置的,能夠在 [ 管理 ] - [ 設置 ] - [ 博客簽名 ] 裏面自定義設置。下面展現個人個性簽名的設置。

/* 個性簽名 */
#MySignature {
    box-shadow: 8px 1px 10px #989898;
    padding: 10px;
    text-shadow: 1px 1px 1px #FFF;
    font-size: 17px;
    border-left: solid 5px #55895B;
    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;
}

6. 博客文章主體樣式

/* 標題title樣式 */
#topics .postTitle {
    font-size: 25px;
    padding: 0 40px;
    border: none;
    box-sizing: border-box;
}

#cb_post_title_url {
    border: 1px solid #55895B;
    border-left-width: 5px;
    border-radius: 10px;
    border-right-width: 5px;
    background-position: left center;
    padding: 15px 50px;
    width: 100%;
    display: inline-block;
    box-sizing: border-box;
}
/*設置背景色和字體大小*/
body {
    font-size: 15px;
    box-sizing: border-box;
}
/*mainContent主體內容容器*/
#main {
    display: flex;
    width: 95%;
}

#mainContent .forFlow {
    margin: 0 0 0 310px;
}

#mainContent {
    margin: 0 0 0 -310px;
}

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

#cnblogs_post_body {
    font-size: 15px;
}

#cnblogs_post_body h2 {
    //標題h2
    border-left: 5px solid #55895B;
    padding: 10px 20px;
    line-height: 2;
    background: #d6dbdf8a;
    margin: 30px 0;
}

#topics .postDesc {
    display: none;
}

7. 其餘部分的樣式

/* 關注收藏等幾個按鈕 */
#green_channel {
    padding: 10px;
    margin: 20px 0;
    font-size: 15px;
    width: 400px;
}

#green_channel a {
    border-radius: 3px;
    text-shadow: none;
    font-weight: normal;
    box-shadow: none;
}
/* 禁用下劃線 */
.postBody a:link, .postBody a:visited, .postBody a:active {
    text-decoration: none;
}

/* 上一篇下一篇 */
#post_next_prev {
    font-size: 14px;
    color: #535353;
}
/*底部隱藏做者,隱藏推薦和反對*/
#author_profile {
    display: none;
}

#div_digg {
    display: none;
}

/*隱藏廣告*/
#ad_t2, #cnblogs_c1, #under_post_news, #cnblogs_c2, #under_post_kb {
    display: none;
}
相關文章
相關標籤/搜索