Make Blog Beautiful

 

     想做一个文艺而专业的编程技术博客 :)

 

     博客定位

     编程大观园,正如其名,探索和汇萃各种编程思想、技术、技能、技巧,并融入自己对编程开发、产品研发的思考和探索。

     

     分类与标签

     好的博客分类能让访客迅速找到自己感兴趣的内容。

     分类主要有两种形式: 主题式分类和标签式分类。主题式分类是纵向的,重量级的,有用且感兴趣的、围绕对博客的定位而形成的博文宏观结构;标签式分类是横向的,轻量级的,灵活的,围绕博文所涉及的点而铺开。比如“编程技术、编程语言”可以作为一个主题大类,而相关的博文有含代码和观点论述的;那么“程序”就可以作为一个标签。标签的选择通常是“两字,常用,细化”为佳。

     好的主题分类能让博客一目了然,好的标签则是对博文的很好的索引。

 

     页面布局

     页面布局主要是横向导航, 侧边栏导航。 侧边栏究竟放在左边还是右边呢? 如果想直接浏览和专注于内容, 内容放在左边似乎更符合习惯; 不过也没有绝对的论断。重点是突出博文内容。比如 BOOK 的模板就做得更好,将内容以书页的形式展示出来,很令人舒适,只是侧边栏做得太 plain 了,因而没有采用。  

 

     页面美化

     首先,依个人喜好选定一个模板,比如我选择的夏日芝兰,比较文艺而且清新简洁; 

     接着,可以在其基础上进行页面美化。美化只需要基本的CSS知识,通常是字体、边框、颜色、对齐、间距, Plus 一点点设计的知识。如果是Chrome 浏览器,右键选择“审查元素”,查看源代码,找到对应的元素进行样式调整,OK后记录下来;这样会形成一个文档,复制到 “博客后台管理-设置-页面CSS” 的文本区域即可。

   定制CSS:   

#blogTitle h2 {
  margin-left: 49px;
  margin-top: 5px;
  font-family: 华文行楷;
  font-size: 16px;
}

#navigator {
  margin-top: 16px;
  font-size: 15px;
}

.dayTitle {
  display:none;
}

#sideBar {
  padding: 0px 10px 10px 15px;
  border-top: 3px outset #FAF7EF;
  border-left: 3px outset #FAF7EF;
  bborder-bottom: 3px outset #FAF7EF;
  margin: 0 0 0 10px;
  border-radius: 10px;
}

#blog-news,#calendar,#sidebar_search,#sidebar_toptags, 
.catListPostCategory, #sidebar_categories.catListPostArchive 
.catListImageCategory, #recent_comments_wrap, #sidebar_topviewedposts 
#sidebar_topcommentedposts, topfeedback_posts_wrap, #sidebar_topdiggedposts{
  margin: 0 5px 5px 0;
}

.day,.entrylist {
  padding: 20px 10px 0 15px;
  border: 3px solid #FAF7EF;
  margin: 0 0 0 -10px;
  border-radius: 10px;
}

.catListTitle {
  margin: 15px 0 5px 0;
  text-align:left;
}

#post_detail, #comment_form, #comment_form_container, #blog-comments-placeholder, #under_post_kb, #under_post_news, #HistoryToday {
  padding: 15px;
  margin-left: -10px;
}

#post_detail, #comment_form {
   border: 3px outset #FAF7EF; 
   border-radius: 15px;
}

#post_detail {
   background-color: #F6EAFC;
}

#under_post_news, #under_post_kb, #HistoryToday {
}

.entrylistDescription {
  margin-bottom: 20px;
  padding-right: 0px;
}

.entrylistPosttitle {
  border-bottom: none;
}

.entrylistTitle, .PostListTitle, .thumbTitle {
  border-bottom: 1px dotted #6466b3;
}

#Header1_HeaderTitle {
  font-family: 隶书;
  font-size: 32pt;
  margin: 5px 0 30px 0;
}

#ad_t2, #cnblogs_c1, #cnblogs_c2 {
  display:none;
}

#HistoryToday .c_ad_block {
  display:none;
}

#under_post_news #under_post_kb, #HistoryToday {
    margin-bottom: 50px;
}

#under_post_news b, #under_post_kb b, #HistoryToday b {
   font-size: 14px;
   margin-bottom: 30px;
}

#under_post_news a, #under_post_kb a, #HistoryToday a {
   font-size: 13px;
   line-height:24px;
}

#under_post_news a:hover, #under_post_kb a:hover, #HistoryToday a:hover {
   color: red;
}

pre {
   margin-left: 25px;
   margin-right: 30px;
}

/* Markdown CSS */

.cnblogs-markdown {
  font-size:13px;
  font-family: 微软雅黑,宋体;
}

.cnblogs-markdown h2,h3 {
 margin-top: 20px; 
}

.cnblogs-markdown p,h4,h5,h6 {
  text-indent:2em!important;
}

.cnblogs-markdown li p {
  text-indent:0em!important;
}
.cnblogs-markdown li {
   margin-left: 45px;
   line-height: 15px; 
}

.cnblogs-markdown a:link { 
  text-decoration: none; 
}
.cnblogs-markdown a:hover {
  color: #DF3A01;
  font-size: 14px; 
  text-decoration: none;
}

.cnblogs-markdown blockquote, code {
   margin: 40px 25px 40px 25px;
   border-radius: 10px;
}

code.language-java {
  border-radius: 15px;
  background-color: #483D8B;
  font-color: #F8F8FF;
}

p img {
    width: 600px;  
    height: 600px;  
    border-radius: 10px;
    margin: 15px 20px 15px 0px;
}

#mycopyright {
   margin: 40px 5px 30px 0px;
}

.cnblogs-markdown #nav {
   margin-bottom: 30px;
}

p {
   margin: 20px 60px 20px 10px; 
}

ol {
   padding: 0px 0px 0px 20px;
}

video {
    margin: 20px 60px 20px 30px; 
    height: 480px;
}

#cnblogs_post_body ul {
    margin-left: 5px;
}

#cnblogs_post_body ol {
    margin-left: 5px;
    padding-left: 5px;
}
View Code

   页脚HTML:

 

 1 <script type="text/javascript">  
 2     var setMyBlog = {
 3         setCopyright: function() {
 4             //设置版权信息,转载出处自动根据页面url生成
 5             var info_str = '<div id="mycopyright"><p>作者:<a target="_blank">@琴水玉</a></p>'+
 6                 '<p>转载请注明出处:<a class="uri"></a></p></div>', 
 7                 info = $(info_str),
 8                 info_a = info.find("a"),
 9                 url = window.location.href;
10             $(info_a[0]).attr("href","https://github.com/shuqin");  
11             $(info_a[1]).attr("href",url).text(url);
12             $("#cnblogs_post_body").append(info);
13         },
14         setCodeRow: function(){
15             
16         },
17         setAtarget: function() {
18             // 博客内的链接在新窗口打开
19             $("#cnblogs_post_body a").each(function(){
20                 this.target = "_blank";
21             }) 
22         },
23         setNav: function() {
24            var nav_str = '<div id="nav"></div>';
25            var nav = $(nav_str); 
26            $(".cnblogs-markdown h2,h3,h4,h5,h6").each(function(i,item){
27                var tag = $(item).get(0).localName;
28                var title = $(item).text();
29                if (title != '公告') {
30                   var titleLowercase = title.toLowerCase(); 
31                   var anchor = '<a class="new' + tag + '" href="#' + titleLowercase + '">'+ title +'</a><br/>';
32                   $("#cnblogs_post_body").prepend(nav);  
33                   $("#nav").append(anchor);      
34                } 
35            }); 
36            $(".newh2").css("margin-left",0);
37            $(".newh3").css("margin-left",20);
38            $(".newh4").css("margin-left",40);
39            $(".newh5").css("margin-left",60);
40            $(".newh6").css("margin-left",80);   
41         },
42         runAll: function() {
43             /* 运行所有方法
44              * setAtarget() 博客园内标签新窗口打开
45              * setContent() 设置目录
46              * setCopyright() 设置版权信息
47              * setCodeRow() 代码行号显示
48              */ 
49             this.setAtarget(); 
50             this.setNav();
51             this.setCopyright();
52             this.setCodeRow();
53         }
54     }
55     setMyBlog.runAll();
56 </script>

 

 

 

   夏日芝兰的完整的CSS 文件:

/* Minification failed. Returning unminified contents.
(512,16): run-time error CSS1036: Expected expression, found ';'
 */
#EntryTag {
    margin-top: 20px;
    font-size: 9pt;
    color: gray;
}
.topicListFooter {
    text-align: right;
    margin-right: 10px;
    margin-top: 10px;
}
#divRefreshComments{
    text-align: right; 
    margin-right: 10px;
    margin-bottom: 5px;
    font-size: 9pt;
}

* {
    margin: 0;
    padding: 0;
}
html {
    height: 100%;
}
body {
    color: #464646;
    font-family: "verdana","ms song","Arial","Helvetica", "sans-serif";
    font-size: 9pt;
    min-height: 101%;
    background:transparent url('/skins/summerGarden/images/bg.jpg')  repeat-x;    
    background-color: #FAF7EF;
}
table {
    border-collapse: collapse;
    border-spacing: 0;
}
fieldset, img {
    border: 0;
}
ul {
    word-break: break-all;
}
li {
    list-style: none;
}
h1, h2, h3, h4, h5, h6 {
    font-size: 100%;
    font-weight: normal;
}
a:link {
    color: #464646;
    text-decoration: none;
}
a:visited {
    color: #464646;
    text-decoration: none;
}
a:hover {
    color: #4c4f8b;
    
}
a:active {
    color: #464646;
    text-decoration: none;
}
.clear {
    clear: both;
}

#home {
    margin: 0 auto;
    width:95%;
    min-width: 930px;
    position:relative; 

}
#header {
    background: url('/skins/summerGarden/images/header.jpg') no-repeat  right top;
    height:146px;
    padding-top:30px;
}
#blogTitle {
    height: 80px;
    clear: both;
    color:#4c4f8b;
}

#blogTitle a:link,#blogTitle a:visited,#blogTitle a:active{
    color:#4c4f8b;
}
#blogTitle a:hover{
    color:#ff6600;
        
}


#blogTitle h1 {
    font-size: 200%;
    font-weight: bold;
    line-height: 1.5em;
    margin-left: 1em;
    margin-top: 10px;
    width: 50%;
    float: left;
}
#blogTitle h2 {
    margin-left: 4em;
    line-height: 1.5em;
    width: 50%;
    float: left;
}
#lnkBlogLogo{
    display:none;
}
#blogLogo {
    float: right;
}
#navigator {
    clear: both;
}
#navList {
    float: left;
}
#navList li {
    float: left;
}
#navList a {
    float: left;
    padding-top: 8px;
    margin-left:20px;
}
#navList a:link, #navList a:visited, #navList a:active {
    color: #666;

}
#navList a:hover {
    color:#ff6600;        
    
}

.aHeaderXML img{
    display:none;
}

.blogStats {
    float: right;
    color: #bbb;
    margin-top: 8px;
    margin-right: 2px;
    text-align: right;
}

#main{
    width: 100%;
    min-width: 950px;
    text-align: left;
}
#mainContent .forFlow{
    margin-left: 24em;
    float: none; 
    width: auto;
}

#mainContent {
    min-height: 200px;
    padding: 0px 0px 10px 0;
    *padding-top:10px;
    -o-text-overflow: ellipsis;
    text-overflow: ellipsis;
    overflow: hidden;
    word-break: break-all;
    
    float: right;
    margin-left: -25em;
    width: 100%
}
.day {
    min-height: 10px;
    _height: 10px;
    margin-bottom: 20px;
    border-bottom:1px dotted #6466b3;
    padding-bottom: 15px;
}
.dayTitle {
    width: 100%;
    color: #6466b3;
    font-weight: bold;
    line-height: 1.5em;
    font-size: 110%;
    margin-top: 3px;
    margin-bottom: 10px;
    clear:both;
    text-align:center;
    display: none;
}
.postTitle {
    font-size: 110%;
    font-weight: bold;
    float: right;
    line-height: 1.5em;
    width: 100%;
    clear:both;
}
.postTitle a:link, .postTitle a:visited, .postTitle a:active {
    color: #6466b3;
}
.postTitle a:hover {
    color: #ff6600;
    
}
.postCon {
    float: right;
    line-height: 1.5em;
    width: 100%;
    clear:both;
    padding: 10px 0;
}
.postDesc {
    float: right;
    width: 100%;
    clear:both;
    text-align: right;
    padding-right: 5px;
    color: #666;
    margin-top: 5px;
}
.postDesc a:link, .postDesc a:visited, .postDesc a:active {
    color: #666;
}
.postDesc a:hover {
    color: #F60;
    text-decoration: none;
}
.postSeparator {
    clear: both;
    height: 5px;
    width: 100%;
    clear:both;
    float: right;
    margin: 0 auto 15px auto;
}

#sideBar {
    width: 230px;
    min-height: 200px;
    padding: 16px 0 0px 5px;
    float: left;
    -o-text-overflow: ellipsis;
    text-overflow: ellipsis;
    overflow: hidden;
    word-break: break-all;
    color:#88866F;
}
.newsItem .catListTitle {
    display: none;
}
.newsItem {
    padding: 15px 0 5px 0px;
    margin-bottom: 8px;
}
/**日历控件样式开始**/
#calendar {
    width: 229px;
}
#calendar .Cal {
    width: 100%;
    line-height: 1.5em;
}
.Cal {/**日历容器table**/
    border: none;
    color: #666;
}
#calendar table a:link, #calendar table a:visited, #calendar table a:active {
    font-weight: bold;
}
#calendar table a:hover {
    color: #6466b3;
    text-decoration: none;
    background-color: #6466b3;
}
.CalTodayDay{/**今天日期样式**/
    color:#6466b3;
    border: dotted 1px #6466b3;
}
#calendar .CalNextPrev a:link,#calendar  .CalNextPrev a:visited, #calendar .CalNextPrev a:active {/**上个月、下个月箭头样式**/
    font-weight: bold;
}
.CalDayHeader{
    border-bottom:1px solid #ccc;    
}
.CalTitle{/**日历年月头部样式**/
    width:100%;
    color:#333;
    border-bottom:1px solid #666;    
}
/**日历控件样式结束**/

#leftcontentcontainer ul a:link,#leftcontentcontainer ul a:visited,#leftcontentcontainer ul a:active{
    color:#88866F;
}
#leftcontentcontainer ul a:hover{
        color:#4c4f8b;
        text-decoration:none;
}

.catListTitle {
    font-weight: bold;
    line-height: 1.5em;
    font-size: 110%;
    margin-top: 15px;
    text-align: center;
    color:#6466b3;
}
.catListComment {
    line-height: 1.5em;
}
.divRecentComment {
    text-indent: 1em;
}
#sideBarMain ul {
    line-height: 1.5em;
}
/*****侧边栏结束********************************/


/****查看文章页面开始*************************/
#topics {
    width: 100%;
    min-height: 200px;
    padding: 0px 0px 10px 0;
    /*float: left;*/
    -o-text-overflow: ellipsis;
    text-overflow: ellipsis;
    overflow: hidden;
}
#topics .postTitle {
    font-size: 130%;
    font-weight: bold;
    float: left;
    line-height: 1.5em;
    width: 100%;
    padding-left: 5px;
    margin-bottom:15px;
}
.postBody {
    padding: 5px 2px 5px 5px;
    line-height: 1.5;
    color: #000;
    border-bottom: 1px solid black;
}
#EntryTag {

}
#EntryTag a {
    margin-left: 5px;
}
#EntryTag a:link, #EntryTag a:visited, #EntryTag a:active {
    color: #4c4f8b;
}
#EntryTag a:hover {
    color: #6466b3;
    
}
#topics .postDesc {
    float: right;
    width: 100%;
    text-align: right;
    padding-right: 5px;
    color: #666;
    margin-top: 5px;
}
.feedback_area_title {
    font-weight: bold;
    margin-top: 20px;
    border-bottom: 1px solid #333;
    margin-bottom: 10px;
    padding-left: 8px;
}
.louzhu {
background:transparent url('/skins/summerGarden/images/icoLouZhu.gif') no-repeat scroll right top;
padding-right:16px;
}
.feedbackListSubtitle {
    color: #666;
}
.feedbackListSubtitle a:link, .feedbackListSubtitle a:visited, .feedbackListSubtitle a:active {
    color: #666;
    font-weight: normal;
}
.feedbackListSubtitle a:hover {
    color: #f60;
    text-decoration: none;
}
.feedbackManage {
    width: 220px;
    text-align: right;
    float: right;
}
.feedbackCon {
    border-bottom: 1px solid #ccc;
    background: url('/skins/summerGarden/images/comment.gif') no-repeat 5px 0px;
    padding: 15px 18px 10px 40px;
    min-height: 35px;
    _height: 35px;
    margin-bottom: 1em;
    line-height: 1.5em;
    width:95%;
}
#divRefreshComments {
    text-align: right;
    margin-bottom: 10px;
}
.commenttb {
    width: 320px;
}
.feedbackListSubtitle b{
    font-weight:normal;
}
/****查看文章页面开始*************************/

/****列表页面开始******************************/
.entrylistTitle,.PostListTitle,.thumbTitle{/**几个分类列表的标题样式**/
    font-size: 110%;
    font-weight: bold;
    border-bottom: 1px solid #6466b3;
    text-align: right;
    padding-bottom: 3px;
    padding-right: 10px;
    color:#6466b3;
}

.entrylistDescription {
    color: #666;
    text-align: right;
    padding-top: 5px;
    padding-bottom: 5px;
    padding-right: 10px;
    margin-bottom: 10px;
}
.entrylistItem {
    min-height: 20px;
    _height: 20px;
    margin-bottom: 30px;
    padding-bottom: 5px;
    width: 100%;
}
.entrylistPosttitle {
    font-size: 110%;
    font-weight: bold;
    border-bottom: 1px dotted #6466b3;
    line-height: 1.5em;
    width: 100%;
    padding-left: 5px;

}
.entrylistPosttitle a:link,.entrylistPosttitle a:visited,.entrylistPosttitle a:active{
        color:#6466b3;
}
.entrylistPosttitle a:hover {
    color:#4c4f8b;
        
}
.entrylistPostSummary {
    margin-top: 5px;
    padding-left: 5px;
    margin-bottom: 5px;
}
.entrylistItemPostDesc {
    text-align: right;
    color: #666;
}
.entrylistItemPostDesc a:link, .entrylistItemPostDesc a:visited, .entrylistItemPostDesc a:active {
    color: #666;
}
.entrylistItemPostDesc a:hover {
    color: #f60;
        
}
.entrylist .postSeparator {
    clear: both;
    width: 100%;
    font-size: 0;
    line-height: 0;
    margin: 0;
    padding: 0;
    height: 0;
    border: none;
}

.pager {
    text-align: right;
    margin-right: 10px;
}
.PostList {
    border-bottom: 1px dotted #6466b3;
    clear: both;
    min-height: 1.5em;
    _height: 1.5em;
    padding-top: 10px;
    padding-left: 5px;
    padding-right: 5px;
    margin-bottom: 5px;
}
.postTitl2 {
    float: left;
}
.postDesc2 {
    color: #666;
    float: right;
    margin-right: ;
}
.postText2 {
    clear: both;
    color: #666;
}
.pfl_feedback_area_title {
    text-align: right;
    line-height: 1.5em;
    font-weight: bold;
    border-bottom: 1px solid #666;
    margin-bottom: 10px;
}
.pfl_feedbackItem {
    border-bottom: 1px solid black;
    margin-bottom: 20px;
}
.pfl_feedbacksubtitle {
    width: 100%;
    border-bottom: 1px dotted #666;
    height: 1.5em;
}
.pfl_feedbackname {
    float: left;
}
.pfl_feedbackManage {
    float: right;
}
.pfl_feedbackCon {
    color: black;
    padding-top: 5px;
    padding-bottom: 5px;
}
.pfl_feedbackAnswer {
    color: #F40;
    text-indent: 2em;
}
.tdSentMessage {
    text-align: right;
}
.errorMessage {
    width: 300px;
    float: left;
}

/****列表页面结束******************************/

/****相册页面开始******************************/
.divPhoto {
    border: 1px solid #6466b3;
    padding: 2px;
    margin-right: 10px;
}

.thumbDescription {
    color: #666;
    text-align: right;
    padding-top: 5px;
    padding-bottom: 5px;
    padding-right: 10px;
    margin-bottom: 10px;
}
/****相册页面开始******************************/


/*****留言页面开始*****************************/
#footer {
    text-align: center;
    height: 41px;
    margin-top: 10px;
    background:url('/skins/summerGarden/images/footer.jpg') no-repeat 220px 0;
    padding-top:40px;
}
/*留言查看页面的个人信息*/
.personInfo {
    margin-bottom: 20px;
}
/*留言分页区域*/
.pages {
    text-align: right;
}
/*****留言页面结束*****************************/
/*****第三部分结束*******************************/

/*文章内部常用标签格式*/
.postBody {
    line-height: 1.5;
    color:#393939;
    font-size:14px;
}
.postBody p,.postCon  p{
    margin: 0 auto 1em auto;
}
.postBody h2{
    font-size: 150%;
    margin: 15px auto 2px auto;
    font-weight:bold;
}
.postBody h3 {
    font-size: 120%;
    margin: 15px auto 2px auto;
    font-weight:bold;
}
.postBody h4{
    font-size:110%;
    margin:15px auto 2px auto;
    font-weight:bold;
    color:#333;
}

.postBody h5{
    font-size:100%;
    margin:15px auto 2px auto;
    font-weight:bold;
    color:#333;
}

.postBody a:link,.postBody a:visited,.postBody a:active{
    color:#6466b3;    
    text-decoration:underline;
}
.postBody a:hover{
    color:#4c4f8b;
}
.postCon a:link,.postCon a:visited,.postCon a:active{
    text-decoration:underline;
}
.postCon a:hover{
    color:#4c4f8b;
}

.postBody ul,.postCon ul{
    margin-left:2em;    
}

.postBody li,.postCon li{
    list-style-type:disc;
    margin-bottom:1em;
}

.postBody blockquote{
    background:url('/skins/summerGarden/images/comment.gif') no-repeat 25px 0px;
    padding:10px 60px 5px 60px;
    min-height:35px;
    _height:35px;
    line-height:1.6em;
    color:#333;
}
/*****第四部分结束*******************************/

.newsItem fieldset{padding:5px;}

.input_my_zzk{width:140px;}

.login_tips a{text-decoration: underline;}

.blog_comment_body a:link{ text-decoration:underline; }
View Code

 

posted @ 2016-08-13 22:40  琴水玉  阅读(776)  评论(0编辑  收藏  举报