博客园基于SimpleMemory主题私人订制
Posted narisu
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了博客园基于SimpleMemory主题私人订制相关的知识,希望对你有一定的参考价值。
博客园后台设置
管理
-> 设置
:
页面定制CSS代码:
/* 禁用下划线 */
.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;
}
/* Minification failed. Returning unminified contents.
(824,7): run-time error CSS1030: Expected identifier, found ' '
(824,15): run-time error CSS1031: Expected selector, found ';'
(824,15): run-time error CSS1025: Expected comma or open brace, found ';'
(1154,42): run-time error CSS1062: Expected semicolon or closing curly-brace, 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{
font-family: 'trebuchet ms', verdana, helvetica, arial, sans-serif!important; /*自定义字体大小和字体*/
}
body {
color: #000;
background-color: #667484; // 背景色蓝色
font-family: 'trebuchet ms', verdana, helvetica, arial, sans-serif!important; /*自定义字体大小和字体*/
font-size: 13px;
min-height: 101%;
}
table {
border-collapse: collapse;
border-spacing: 0;
}
fieldset, img {
border: 0;
}
li {
list-style: none;
}
h1, h2, h3, h4, h5, h6 {
font-size: 100%;
font-weight: normal;
}
a {
outline: none;
color: #21759b;
}
a:link {
color: black;
text-decoration: none;
}
a:visited {
color: black;
text-decoration: none;
}
a:hover {
color: #21759b;
}
a:active {
color: black;
text-decoration: none;
}
.clear {
clear: both;
}
/*****第二部分结束*******************************/
/**************************************************
第三部分:各个页面元素的样式。
**************************************************/
/*****home和头部开始**************************/
#home {
margin: 0 auto;
width: 46%;
min-width: 666px; // 写字板宽度设置
background-color: #fff;
padding: 15px; // 文本离边框的距离设置
margin-top: 0px; // 白板距离上边框的距离
margin-bottom: 0px; // 白板距离下边框的距离
box-shadow: 0 2px 6px rgba(100, 100, 100, 0.3);
}
#header {
padding-bottom: 5px;
margin-top: 10px;
}
#blogTitle {
height: 0px; // 导航栏距离副标题(签名)的距离
clear: both;
}
#blogTitle h1 {
font-size: 26px;
font-weight: bold;
line-height: 1.5em;
margin-top: -17px; // 昵称距离顶部距离
}
#blogTitle h1 a {
color: #515151;
}
#blogTitle h1 a:hover {
color: #21759b;
}
#blogTitle h2 {
font-weight: normal;
font-size: 13px;
font-size: 0.928571429rem;
line-height: 1.846153846;
color: #757575;
float: left;
}
#blogLogo {
float: right;
}
#navigator {
font-size: 13px;
border-bottom: 1px solid #ededed;
border-top: 1px solid #ededed;
height: 50px;
clear: both;
margin-top: 25px;
}
#navList {
min-height: 30px;
float: left;
}
#navList li {
float: left;
margin: 0 40px 0 0;
}
#navList a {
display: block;
width: 5em;
height: 22px;
float: left;
text-align: center;
padding-top: 19px;
}
#navList a:link, #navList a:visited, #navList a:active {
color: #6a6a6a;
font-weight: bold;
}
#navList a:hover {
color: #000;
text-decoration: none;
}
.blogStats {
float: right;
color: #757575;
margin-top: 19px;
margin-right: 2px;
text-align: right;
}
/*****home和头部结束**************************/
/*****主页文章列表开始**************************/
#main {
width: 100%;
text-align: left;
margin-top: 1px; // 首页文章标题距离设置
}
#mainContent .forFlow {
margin-left: 22em;
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;
float: left;
margin-left: -22em;
width: 100%;
}
.day {
min-height: 10px;
_height: 10px;
margin-bottom: 20px;
padding-bottom: 5px;
position: relative;
}
.dayTitle {
display: none;
border: 1px solid #21759b;
background: azure;
border-radius: 50%;
font-size: 12px;
height: 65px;
line-height: 1.5;
margin: 15px;
text-align: center;
width: 63px;
margin-left: -100px;
clear: both;
position: absolute;
top: -15px;
}
.dayTitle a {
display: inline-block;
color: #21759b;
margin-top: 15px;
width: 60px;
}
.postTitle {
border-left: 3px solid #21759b;
margin-bottom: 10px;
font-size: 18px;
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;
}
.postDesc {
font-size: 13px;
background: url(images/posted_time.png) no-repeat 0 1px;
color: #757575;
float: left;
width: 100%;
clear: both;
text-align: left;
padding-left: 20px;
padding-right: 5px;
margin-top: 20px;
line-height: 1.5;
}
.postDesc a:link, .postDesc a:visited, .postDesc a:active {
color: #666;
}
.postDesc a:hover {
color: #21759b;
text-decoration: none;
}
.postSeparator {
clear: both;
height: 1px;
width: 100%;
clear: both;
float: right;
margin: 0 auto 15px auto;
}
/*****主页文章列表开始**************************/
/*****侧边栏开始********************************/
#sideBar {
margin-top: -15px;
width: 230px;
min-height: 200px;
padding: 0px 0 0px 5px;
float: right;
-o-text-overflow: ellipsis;
text-overflow: ellipsis;
overflow: hidden;
}
#sideBar a {
color: #757575;
}
#sideBar a:hover {
color: #21759b;
text-decoration: underline;
}
.div_my_zzk {
width: 175px;
position: relative;
margin-top: 10px;
}
#btnZzk {
background: url("images/blog_search.png") no-repeat 5px 5px;
}
#widget_my_google input[type=button] {
background: url("images/google_search.png") no-repeat 5px 5px;
}
.input_my_zzk {
border: 1px solid #ccc;
width: 100%;
height: 25px;
padding-right: 30px;
padding-left: 5px;
outline: 0;
}
.btn_my_zzk {
font-size: 12px;
width: 25px;
height: 25px;
color: transparent;
border: 0;
border-style: none;
cursor: pointer;
top: 1px;
position: absolute;
right: -35px;
}
.input_my_zzk:hover {
border: 1px solid #21759b;
transition: all 0.4s linear 0s;
}
.input_my_zzk:focus {
border: 1px solid #21759b;
}
.newsItem, .catListEssay, .catListLink, .catListNoteBook, .catListTag, .catListPostCategory, .catListPostArchive, .catListImageCategory, .catListArticleArchive, .catListView, .catListFeedback, .mySearch, .catListComment, .catListBlogRank, .catList, .catListArticleCategory {
background: #fff;
margin-bottom: 35px;
word-wrap: break-word;
}
.newsItem .catListTitle {
}
/**日历控件样式开始**/
#blog-calendar {
width: 228px;
padding-bottom: 5px;
margin-bottom: 35px;
box-shadow: 0 1px 3px #ccc;
border: 1px solid #EDEDED;
}
#blog-calendar td {
font-size: 12px;
font-family: 'trebuchet ms', verdana, helvetica, arial, sans-serif;
// font-family: "Comic Sans MS";
}
#blog-calendar th {
font-size: 12px;
}
#calendar {
width: 228px;
padding-bottom: 5px;
margin-bottom: 35px;
border: 1px solid #EDEDED;
box-shadow: 0 1px 3px #ccc;
}
#calendar .Cal {
width: 100%;
line-height: 1.5em;
}
#calendar td {
font-family: 'trebuchet ms', verdana, helvetica, arial, sans-serif;
// font-family: "Comic Sans MS";
background: #FFFFFF;
padding-top: 2px;
}
.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: white;
text-decoration: none;
}
.CalTodayDay { /**今天日期样式**/
background: #3671a5 !important;
color: #FFF;
font-weight: bold;
}
.CalWeekendDay {
padding-top: 4px;
padding-bottom: 4px;
}
.CalOtherMonthDay {
color: #ccc;
padding-top: 4px;
padding-bottom: 4px;
}
#calendar .CalNextPrev a:link, #calendar .CalNextPrev a:visited, #calendar .CalNextPrev a:active { /**上个月、下个月箭头样式**/
font-weight: bold;
padding-left: 10px;
padding-right: 15px;
}
.CalDayHeader {
background: #F8F8F8;
font-weight: 100;
color: #5E5F63;
}
.CalTitle { /**日历年月头部样式**/
background: #6293bb;
width: 100%;
height: 25px;
text-align: center;
font-size: 14px;
font-weight: bold;
padding: 5px 0;
color: #FFF;
}
.CalTitle td {
background: #F8F8F8 !important;
border: 0px !important;
color: #5E5F63;
font-family: 'trebuchet ms', verdana, helvetica, arial, sans-serif;
// font-family: "Comic Sans MS";
}
/**日历控件样式结束**/
.catListTitle {
font-weight: bold;
line-height: 1.2;
font-size: 110%;
margin-top: 15px;
margin-bottom: 10px;
text-align: left;
}
.catListComment {
line-height: 1.5em;
}
.divRecentComment {
text-indent: 2em;
color: #494949;
margin-bottom: 20px;
}
#sideBarMain ul {
line-height: 1.5em;
}
#sideBarMain li {
line-height: 1.8;
}
/*****侧边栏结束********************************/
/****查看文章页面开始*************************/
#topics {
width: 100%;
min-height: 200px;
padding: 0px 0px 10px 0;
float: left;
-o-text-overflow: ellipsis;
text-overflow: ellipsis;
overflow: hidden;
}
#topics .postTitle {
border: 0px;
font-size: 130%;
font-weight: bold;
float: left;
line-height: 1.5;
width: 100%;
padding-left: 5px;
}
#EntryTag {
color: #666;
}
#EntryTag a {
margin-left: 5px;
height: 20px;
line-height: 20px;
color: #333333;
padding: 3px 14px;
border-radius: 10px;
margin: 2px 5px 0;
background: #e7e7e7;
text-decoration: none;
}
#EntryTag a:link, #EntryTag a:visited, #EntryTag a:active {
color: #666;
}
#EntryTag a:hover {
color: #f5f5f5;
background: #21759b;
transition: all 0.4s linear 0s;
}
#BlogPostCategory {
color: #666;
}
#BlogPostCategory a {
margin-left: 5px;
height: 20px;
line-height: 20px;
color: #333333;
padding: 3px 14px;
border-radius: 10px;
margin: 2px 5px 0;
background: #e7e7e7;
text-decoration: none;
}
#BlogPostCategory a:link, #BlogPostCategory a:visited, #BlogPostCategory a:active {
color: #666;
}
#BlogPostCategory a:hover {
color: #f5f5f5;
background: #21759b;
}
#topics .postDesc {
padding-left: 0px;
width: 100%;
text-align: left;
color: #666;
margin-top: 5px;
background: none;
}
.feedback_area_title {
font: normal normal 16px/35px "Microsoft YaHei";
margin: 10px 0 30px;
border-bottom: 2px solid #cccccc;
}
.louzhu {
background: transparent url('/images/icoLouZhu.gif') no-repeat scroll right top;
padding-right: 16px;
}
.feedbackListSubtitle {
color: #A8A8A8;
}
.feedbackListSubtitle a:link, .feedbackListSubtitle a:visited, .feedbackListSubtitle a:active {
color: #21759b;
font-weight: bold;
}
.feedbackListSubtitle a:hover {
color: #21759b;
text-decoration: underline;
}
.feedbackListSubtitle b {
color: #21759b;
}
.feedbackManage {
width: 200px;
text-align: right;
float: right;
}
.feedbackCon {
border-bottom: 1px solid #EEE;
padding: 10px 20px 10px 5px;
min-height: 35px;
_height: 35px;
margin-bottom: 1em;
line-height: 1.5;
}
#divRefreshComments {
text-align: right;
margin-bottom: 10px;
}
.commenttb {
padding: 8px;
margin-bottom: 10px;
width: 50%;
color: #555;
border: 1px solid #ddd;
border-radius: 3px;
-moz-border-radius: 3px;
-webkit-border-radius: 3px;
width: 320px;
}
.commenttb:hover {
color: #333;
border-color: rgba(82, 168, 236, 0.8);
outline: 0;
-webkit-box-shadow: inset 1px 1px 1px rgba(0, 0, 0, 0.075), 0 0 4px rgba(82, 168, 236, 0.6);
-moz-box-shadow: inset 1px 1px 1px rgba(0, 0, 0, 0.075), 0 0 4px rgba(82, 168, 236, 0.6);
box-shadow: inset 1px 1px 1px rgba(0, 0, 0, 0.075), 0 0 4px rgba(82, 168, 236, 0.6);
transition: all 0.4s linear 0s;
}
.commentTextBox {
width: 410px !important;
margin-top: 10px;
margin-bottom: 10px;
}
.commentTextBox:hover {
color: #333;
border-color: rgba(82, 168, 236, 0.8);
outline: 0;
-webkit-box-shadow: inset 1px 1px 1px rgba(0, 0, 0, 0.075), 0 0 4px rgba(82, 168, 236, 0.6);
-moz-box-shadow: inset 1px 1px 1px rgba(0, 0, 0, 0.075), 0 0 4px rgba(82, 168, 236, 0.6);
box-shadow: inset 1px 1px 1px rgba(0, 0, 0, 0.075), 0 0 4px rgba(82, 168, 236, 0.6);
transition: all 0.4s linear 0s;
}
#AjaxHolder_PostComment_btnSubmit {
padding: 8px 20px;
text-align: center;
font-size: 13px;
color: #fff;
border: none;
background: #21759b;
border-radius: 3px;
-moz-border-radius: 3px;
-webkit-border-radius: 3px;
-webkit-transition: all 0.4s ease;
-moz-transition: all 0.4s ease;
-o-transition: all 0.4s ease;
-ms-transition: all 0.4s ease;
transition: all 0.4s ease;
cursor: pointer;
display: inline-block;
vertical-align: middle;
outline: none;
text-decoration: none;
}
#AjaxHolder_PostComment_btnSubmit:hover {
background: #333;
}
#AjaxHolder_PostComment_divCommnentArea tr {
margin-top: 10px;
margin-bottom: 10px;
}
/*博客园评论框*/
.comment_vote {
padding-right: 10px;
}
.comment_vote a {
color: #999;
}
.comment_vote a:hover {
color: #21759b;
}
#commentform_title {
font: normal normal 16px/35px "Microsoft YaHei";
margin: 10px 0 30px;
border-bottom: 2px solid #cccccc;
background-image: none;
padding: 0;
}
#comment_form_container .author {
padding-left: 10px;
color: #555;
border: 1px solid #ddd;
border-radius: 3px;
-moz-border-radius: 3px;
-webkit-border-radius: 3px;
width: 320px;
height: 20px;
background-image: none;
}
#comment_form_container p {
font-size: 13px;
margin-bottom: 20px;
}
.commentbox_title_left {
font-size: 13px;
}
.commentbox_title_right {
float: left;
}
#comment_form_container .comment_textarea {
width: 362px;
height: 200px;
font-size: 13px;
padding: 8px;
margin-bottom: 10px;
color: #555;
border: 1px solid #ddd;
border-radius: 3px;
-moz-border-radius: 3px;
-webkit-border-radius: 3px;
}
#comment_form_container .comment_textarea:hover {
border-color: rgba(82, 168, 236, 0.8);
outline: 0;
transition: all 0.4s linear 0s;
}
#comment_form_container .comment_textarea:focus {
outline: 0;
}
.comment_btn {
width: 100px;
height: 38px;
padding: 8px 20px;
text-align: center;
font-size: 13px;
color: #fff;
border: none;
background: #21759b;
border-radius: 3px;
-moz-border-radius: 3px;
-webkit-border-radius: 3px;
-webkit-transition: all 0.4s ease;
-moz-transition: all 0.4s ease;
-o-transition: all 0.4s ease;
-ms-transition: all 0.4s ease;
transition: all 0.4s ease;
cursor: pointer;
display: inline-block;
vertical-align: middle;
outline: none;
text-decoration: none;
}
.comment_btn:hover {
background: #333;
}
#comment_form_container {
}
/****查看文章页面开始*************************/
/****列表页面开始******************************/
.entrylistTitle, .PostListTitle, .thumbTitle { /**几个分类列表的标题样式**/
margin-bottom: 25px;
height: 38px;
line-height: 38px;
font-size: 15px;
border-bottom: 2px solid #e6e6e6;
}
color: #21759b; .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: 50px;
padding-top: 10px;
width: 100%;
}
.entrylistPosttitle {
padding-left: 15px;
margin-bottom: 10px;
border-left: 3px solid #21759b;
font-size: 18px;
width: 100%;
}
.entrylistPosttitle a:link, .entrylistPosttitle a:visited, .entrylistPosttitle a:active {
color: #21759b;
transition: all 0.4s linear 0s;
}
.entrylistPosttitle a:hover {
margin-left: 30px;
color: #0f3647;
text-decoration: none;
}
.entrylistPostSummary {
margin-top: 5px;
margin-bottom: 5px;
}
.entrylistItemPostDesc {
margin-top: 20px;
text-align: left;
color: #757575;
padding-left: 5px;
}
.entrylistItemPostDesc a:link, .entrylistItemPostDesc a:visited, .entrylistItemPostDesc a:active {
color: #666;
}
.entrylistItemPostDesc a:hover {
color: #21759b;
}
.entrylist .postSeparator {
clear: both;
width: 100%;
font-size: 0;
line-height: 0;
margin: 0;
padding: 0;
height: 0;
border: none;
}
.divRecentCommentAticle a {
color: #000;
}
.pager {
text-align: right;
margin-right: 10px;
}
.pager a {
box-shadow: 0 1px 3px #3671a5;
border: 1px solid #3671a5;
background: #3671a5;
color: white;
transition: all 0.4s linear 0s;
}
.pager a:hover {
background: #000;
}
.PostList {
border-bottom: 1px solid #ccc;
clear: both;
min-height: 1.5em;
_height: 1.5em;
padding-top: 20px;
margin-bottom: 20px;
padding-bottom: 20px;
}
.postTitl2 {
float: left;
padding-top: 10px;
padding-bottom: 10px;
font-size: 13px;
}
.postDesc2 {
color: #666;
float: right;
}
.postText2 {
clear: both;
color: #757575;
}
/*留言*/
.pfl_feedback_area_title {
text-align: right;
line-height: 1.5em;
font-weight: bold;
margin-bottom: 10px;
}
.pfl_feedbackItem {
border: 1px dashed #ccc;
padding: 10px;
border-radius: 3px;
margin-bottom: 20px;
}
.pfl_feedbacksubtitle {
width: 100%;
height: 1.5em;
}
.pfl_feedbackname {
float: left;
}
.pfl_feedbackname a {
color: #21759b;
font-weight: bold;
}
.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;
}
#Profile1_panelAdd input[type=text], #Profile1_txtContent {
padding: 8px;
margin-bottom: 10px;
color: #555;
border: 1px solid #ddd;
border-radius: 3px;
-moz-border-radius: 3px;
-webkit-border-radius: 3px;
}
#Profile1_panelAdd input[type=text]:hover, #Profile1_txtContent:hover {
color: #333;
border-color: rgba(82, 168, 236, 0.8);
outline: 0;
-webkit-box-shadow: inset 1px 1px 1px rgba(0, 0, 0, 0.075), 0 0 4px rgba(82, 168, 236, 0.6);
-moz-box-shadow: inset 1px 1px 1px rgba(0, 0, 0, 0.075), 0 0 4px rgba(82, 168, 236, 0.6);
box-shadow: inset 1px 1px 1px rgba(0, 0, 0, 0.075), 0 0 4px rgba(82, 168, 236, 0.6);
transition: all 0.4s linear 0s;
}
#Profile1_panelAdd input[type=text]:focus, #Profile1_txtContent:focus {
outline: 0;
border-color: rgba(82, 168, 236, 0.8);
}
#Profile1_panelAdd input[type=submit] {
padding: 8px 20px;
text-align: center;
font-size: 13px;
color: #fff;
border: none;
background: #21759b;
border-radius: 3px;
-moz-border-radius: 3px;
-webkit-border-radius: 3px;
-webkit-transition: all 0.4s ease;
-moz-transition: all 0.4s ease;
-o-transition: all 0.4s ease;
-ms-transition: all 0.4s ease;
transition: all 0.4s ease;
cursor: pointer;
display: inline-block;
vertical-align: middle;
outline: none;
text-decoration: none;
}
#Profile1_panelAdd input[type=submit]:hover {
background: #333;
}
.feedbackListSubtitle {
clear: both;
color: #A8A8A8;
padding: 8px 5px;
}
.feedbackItem {
margin-top: 30px;
}
/****列表页面结束******************************/
/****相册页面开始******************************/
.divPhoto {
border: 1px solid #ccc;
padding: 2px;
margin-right: 10px;
}
.thumbDescription {
color: #757575;
text-align: right;
padding-top: 5px;
padding-bottom: 5px;
padding-right: 10px;
margin-bottom: 30px;
}
/****相册页面开始******************************/
/*****留言页面开始*****************************/
#footer {
color: #686868;
text-align: center;
min-height: 15px;
_height: 15px;
border-top: 1px solid #ededed;
margin-top: 50px;
padding-top: 10px;
margin-bottom: 10px;
}
/*留言查看页面的个人信息*/
.personInfo {
margin-bottom: 20px;
}
/*留言分页区域*/
.pages {
text-align: right;
}
/*****留言页面结束*****************************/
/*****第三部分结束*******************************/
/**************************************************
第四部分:文章内容常用标签格式。
**************************************************/
/*文章内部常用标签格式*/
.postBody {
color: #000;
line-height: 1.7;
font-size: 13px;
}
.postBody p, .postCon p {
text-indent: 2em;
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 {
text-decoration: underline;
}
.postCon a:link, .postCon a:visited, .postCon a:active {
text-decoration: underline;
}
.postBody ul, .postCon ul {
margin-left: 2em;
}
.postBody li, .postCon li {
list-style-type: disc;
margin-bottom: 1em;
}
.postBody blockquote {
background: url('images/comment.gif')) no-repeat 25px 0px;
min-height: 35px;
_height: 35px;
line-height: 1.6em;
color: #333;
}
/*****第四部分结束*******************************/
.myposts_title {
font-weight: bold;
text-align: center;
}
#sideBar {
font-size: 13px;
}
#sideBar h3 {
font-size: 13px;
}
.c_b_p_desc {
font-size: 13px;
line-height: 1.7;
}
#cnblogs_post_body img{
max-width: 700px;
}
/*生成博客目录的CSS*/
#uprightsideBar{
font-size:12px;
font-family:Arial, Helvetica, sans-serif;
text-align:left;
position:fixed;/*将div的位置固定到距离top:50px,right:0px的位置,这样div就会处在最右边的位置,距离顶部50px*/
top:50px;
right:0px;
width: auto;
height: auto;
}
#sideBarTab{
float:left;
width:30px;
border:1px solid #e5e5e5;
border-right:none;
text-align:center;
background:#ffffff;
}
#sideBarContents{
float:left;
overflow:auto;
overflow-x:hidden;!important;
width:200px;
min-height:108px;
max-height:460px;
border:1px solid #e5e5e5;
border-right:none;
background:#ffffff;
}
#sideBarContents dl{
margin:0;
padding:0;
}
#sideBarContents dt{
margin-top:5px;
margin-left:5px;
}
#sideBarContents dd, dt {
cursor: pointer;
}
#sideBarContents dd:hover, dt:hover {
color:#A7995A;
}
#sideBarContents dd{
margin-left:20px;
}
页首Html代码:
<script type="text/javascript">
/*
功能:生成博客目录的JS工具
测试:IE8,火狐,google测试通过
孤傲苍狼
2014-5-11
*/
var BlogDirectory = {
/*
获取元素位置,距浏览器左边界的距离(left)和距浏览器上边界的距离(top)
*/
getElementPosition:function (ele) {
var topPosition = 0;
var leftPosition = 0;
while (ele){
topPosition += ele.offsetTop;
leftPosition += ele.offsetLeft;
ele = ele.offsetParent;
}
return {top:topPosition, left:leftPosition};
},
/*
获取滚动条当前位置
*/
getScrollBarPosition:function () {
var scrollBarPosition = document.body.scrollTop || document.documentElement.scrollTop;
return scrollBarPosition;
},
/*
移动滚动条,finalPos 为目的位置,internal 为移动速度
*/
moveScrollBar:function(finalpos, interval) {
//若不支持此方法,则退出
if(!window.scrollTo) {
return false;
}
//窗体滚动时,禁用鼠标滚轮
window.onmousewheel = function(){
return false;
};
//清除计时
if (document.body.movement) {
clearTimeout(document.body.movement);
}
var currentpos =BlogDirectory.getScrollBarPosition();//获取滚动条当前位置
var dist = 0;
if (currentpos == finalpos) {//到达预定位置,则解禁鼠标滚轮,并退出
window.onmousewheel = function(){
return true;
}
return true;
}
if (currentpos < finalpos) {//未到达,则计算下一步所要移动的距离
dist = Math.ceil((finalpos - currentpos)/10);
currentpos += dist;
}
if (currentpos > finalpos) {
dist = Math.ceil((currentpos - finalpos)/10);
currentpos -= dist;
}
var scrTop = BlogDirectory.getScrollBarPosition();//获取滚动条当前位置
window.scrollTo(0, currentpos);//移动窗口
if(BlogDirectory.getScrollBarPosition() == scrTop)//若已到底部,则解禁鼠标滚轮,并退出
{
window.onmousewheel = function(){
return true;
}
return true;
}
//进行下一步移动
var repeat = "BlogDirectory.moveScrollBar(" + finalpos + "," + interval + ")";
document.body.movement = setTimeout(repeat, interval);
},
htmlDecode:function (text){
var temp = document.createElement("div");
temp.innerHTML = text;
var output = temp.innerText || temp.textContent;
temp = null;
return output;
},
/*
创建博客目录,
id表示包含博文正文的 div 容器的 id,
mt 和 st 分别表示主标题和次级标题的标签名称(如 H2、H3,大写或小写都可以!),
interval 表示移动的速度
*/
createBlogDirectory:function (id, mt, st, interval){
//获取博文正文div容器
var elem = document.getElementById(id);
if(!elem) return false;
//获取div中所有元素结点
var nodes = elem.getElementsByTagName("*");
//创建博客目录的div容器
var divSideBar = document.createElement('DIV');
divSideBar.className = 'uprightsideBar';
divSideBar.setAttribute('id', 'uprightsideBar');
var divSideBarTab = document.createElement('DIV');
divSideBarTab.setAttribute('id', 'sideBarTab');
divSideBar.appendChild(divSideBarTab);
var h2 = document.createElement('H2');
divSideBarTab.appendChild(h2);
var txt = document.createTextNode('目录导航');
h2.appendChild(txt);
var divSideBarContents = document.createElement('DIV');
divSideBarContents.style.display = 'none';
divSideBarContents.setAttribute('id', 'sideBarContents');
divSideBar.appendChild(divSideBarContents);
//创建自定义列表
var dlist = document.createElement("dl");
divSideBarContents.appendChild(dlist);
var num = 0;//统计找到的mt和st
mt = mt.toUpperCase();//转化成大写
st = st.toUpperCase();//转化成大写
//遍历所有元素结点
for(var i=0; i<nodes.length; i++)
{
if(nodes[i].nodeName == mt|| nodes[i].nodeName == st)
{
//获取标题文本
var nodetext = nodes[i].innerHTML.replace(/<\\/?[^>]+>/g,"");//innerHTML里面的内容可能有HTML标签,所以用正则表达式去除HTML的标签
nodetext = nodetext.replace(/ /ig, "");//替换掉所有的
nodetext = BlogDirectory.htmlDecode(nodetext);
//插入锚
nodes[i].setAttribute("id", "blogTitle" + num);
var item;
switch(nodes[i].nodeName)
{
case mt: //若为主标题
item = document.createElement("dt");
break;
case st: //若为子标题
item = document.createElement("dd");
break;
}
//创建锚链接
var itemtext = document.createTextNode(nodetext);
item.appendChild(itemtext);
item.setAttribute("name", num);
item.onclick = function(){ //添加鼠标点击触发函数
var pos = BlogDirectory.getElementPosition(document.getElementById("blogTitle" + this.getAttribute("name")));
if(!BlogDirectory.moveScrollBar(pos.top, interval)) return false;
};
//将自定义表项加入自定义列表中
dlist.appendChild(item);
num++;
}
}
if(num == 0) return false;
/*鼠标进入时的事件处理*/
divSideBarTab.onmouseenter = function(){
divSideBarContents.style.display = 'block';
}
/*鼠标离开时的事件处理*/
divSideBar.onmouseleave = function() {
divSideBarContents.style.display = 'none';
}
document.body.appendChild(divSideBar);
}
};
window.onload=function(){
/*页面加载完成之后生成博客目录*/
BlogDirectory.createBlogDirectory("cnblogs_post_body","h2","h3",20);
}
</script>
参考帖子
博客园自定义样式
JavaScript自动生成博文目录导航
【详细图解】一步一步教你自定义博客园(cnblog)界面
以上是关于博客园基于SimpleMemory主题私人订制的主要内容,如果未能解决你的问题,请参考以下文章
博客主题SimpleMemory与本地Markdown文件直接上传