zoukankan      html  css  js  c++  java
  • 自定义css样式美化博客园

    自定义css样式美化博客园

    首先说明,我选用的博客皮肤是MTClean,以下样式在其他皮肤下有些并不适用。

    针对MTClean皮肤的美化

    /* 设置tongqingliu顶部间距*/
    h1 {
        margin-top: 20px;
    }
    
    /* 设置tongqingliu方框及背景*/
    #top {
        color: #333;
        margin-left: 50px;
        margin-right: 50px;
        border-radius: 10px;
        background-color: royalblue;
        border-top:0px;
        padding-bottom: 35px;
        text-align: center;
    }
    
    /* 设置tongqingliu字体及大小*/
    #top a, #top a:link, #top a:visited, #top a:active, #top a:hover {
        font-family: "Comic Sans MS";
        font-size: larger;
        color: whitesmoke;
    }
    
    /* 设置保持学习的态度 */
    #tagline {
        margin-top: 20px;
        font-size: large;
        color:white;
    }
    
    /* 导航及以文字所在方框的位置 */
    #leftmenu {
        margin-top: 100px;
    }
    
    /* 导航,统计信息 */
    #leftmenu h3 {
        font-family: palatino,georgia,times new roman,serif;
        color: whitesmoke;
        background-color: royalblue;
        font-size: 1.5em;
        font-weight: normal;
        padding: 3px;
        margin-top: 0;
        line-height: 1.5;
        letter-spacing: .1em;
        text-transform: uppercase;
    }
    
    /* 首页,联系,管理,随笔,文章,评论 */
    #leftmenu ul {
        font-size: 14px;
    }
    
    /* 置顶随笔及以下所在方框 */
    #main {
        margin-top: 50px;
    }
    
    /* 置顶随笔, 日期  */
    p.date {
        color: black;
        font-family: Palatino,georgia,times new roman,serif;
        font-size: 1em;
        font-weight: bold;
        padding-top: 15px;
        padding-bottom: 10px;
        display: none;
    }
    
    /* 设置首页目录 */
    div.post h2 a:link {
        font-family: Palatino,Georgia,Verdana,arir,Sans-Serif;
        font-size: 18pt;
        font-weight: bold;
        color: whitesmoke;
        background-color: green;
        line-height: 40px;
        text-decoration: none;
    }
    div.post h2 a:visited {
        font-family: Palatino,Georgia,Verdana,arir,Sans-Serif;
        font-size: 18pt;
        font-weight: bold;
        line-height: 40px;
        color: whitesmoke;
        background-color: green;
        text-decoration: none;
    }
    div.post h2 {
        font-family: palatino,georgia,verdana,arial,sans-serif;
        font-size: 18pt;
        /* color: #606060; */
        font-weight: bold;
        /* background: #fff; */
        line-height: 40px;
        margin-top: 28px;
        background-color: green;
        text-decoration: none;
    }
    

    美化博客内容

    /* 设置博客正文一二三级标题格式 */
    /* 一级标题 */
    #cnblogs_post_body h1 {
        font-size: 28px;
        font-weight: bold;
        line-height: 1.5;
        color: black;
        margin: 10px 0;
    }
    /* 二级标题 */
    #cnblogs_post_body h2 {
        font-size: 24px;
        font-weight: bold;
        line-height: 1.5;
        color: whitesmoke;
        background-color: royalblue;
        margin: 10px 0;
    }
    /* 三级标题 */
    #cnblogs_post_body h3 {
        font-size: 20px;
        font-weight: bold;
        line-height: 1.5;
        color: whitesmoke;
        background-color: dimgrey;
    }
    /*  正文 */
    #cnblogs_post_body p {
        font-size: 12pt;
    }
    

    美化签名

    /* 设置签名格式 */
    #MySignature {
        display: none;
        background-color: #B2E866;
        border-radius: 10px;
        box-shadow: 1px 1px 1px #6B6B6B;
        padding: 10px;
        line-height: 1.5;
        text-shadow: 1px 1px 1px #FFF;
        font-size: 16px;
        font-family: 'Microsoft Yahei';
    }
    

    美化推荐及反对

    设置推荐及反对按钮在页面右下角浮动显示,屏蔽反对按钮。

    /* 推荐及反对 */
    #div_digg {
        padding: 5px;
        position: fixed;
        z-index: 1000;
        bottom: 0px;
        right: 0;
        border: 0px solid #D9DBE1;
        background-color: #FFFFFF;
        opacity: 0.8;
         46px;
        float: right;
        margin-bottom: 10px;
        margin-right: 10px;
        font-size: 12px;
        text-align: center;
        margin-top: 10px;
        border: 2px solid red;
    }
    /* ignore反对 */
    .buryit {
        display: none;
    }
    

    美化代码

    代码使用Monokai样式。

    /*
    Monokai Sublime style. Derived from Monokai by noformnocontent http://nn.mit-license.org/
    */
    pre {
    /*控制代码不换行*/
        white-space: pre;
        word-wrap: normal;
    }
    .cnblogs-markdown .hljs {
        font-size: 16px!important;
        font-family: consolas,monospace !important;
        display: block;
        overflow-x: auto;
        padding: 0.5em;
        background: #23241f !important;
        color: #FFF;
        white-space: pre;
        word-break: normal;
        padding: 10px 15px !important;
    }
    
    .hljs,
    .hljs-tag,
    .hljs-subst {
      color: #f8f8f2;
    }
    
    .hljs-strong,
    .hljs-emphasis {
      color: #a8a8a2;
    }
    
    .hljs-bullet,
    .hljs-quote,
    .hljs-number,
    .hljs-regexp,
    .hljs-literal,
    .hljs-link {
      color: #ae81ff;
    }
    
    .hljs-code,
    .hljs-title,
    .hljs-section,
    .hljs-selector-class {
      color: #a6e22e;
    }
    
    .hljs-strong {
      font-weight: bold;
    }
    
    .hljs-emphasis {
      font-style: italic;
    }
    
    .hljs-keyword,
    .hljs-selector-tag,
    .hljs-name,
    .hljs-attr {
      color: #f92672;
    }
    
    .hljs-symbol,
    .hljs-attribute {
      color: #66d9ef;
    }
    
    .hljs-params,
    .hljs-class .hljs-title {
      color: #f8f8f2;
    }
    
    .hljs-string,
    .hljs-type,
    .hljs-built_in,
    .hljs-builtin-name,
    .hljs-selector-id,
    .hljs-selector-attr,
    .hljs-selector-pseudo,
    .hljs-addition,
    .hljs-variable,
    .hljs-template-variable {
      color: #e6db74;
    }
    
    .hljs-comment,
    .hljs-deletion,
    .hljs-meta {
      color: #75715e;
    }
    

    屏蔽广告

    /* adblock */
    #ad_t2 {
        display: none;
    }
    .c_ad_block {
        display: none;
    }
    

    以上样式可以直接在【页面定制CSS代码】中使用。

    美化博客侧边栏公告

    插入时钟:
    http://www.blogclock.cn/
    插入访客来源:
    http://s11.flagcounter.com/more/Fe64/
    插入总访客数:
    http://www.amazingcounters.com/
    插入QQ通讯组件:
    https://connect.qq.com/intro/wpa

    生成后的代码放在【博客侧边栏公告(支持HTML代码)(支持JS代码)】中。

    增加打赏按钮

    <script src="http://static.tctip.com/tctip-1.0.0.min.js"></script>
      <script>  
      new tctip({
        top: '20%',
        button: {
          id: 9,
          type: 'dashang',
        },
        list: [
          {
            type: 'alipay',
            qrImg: 'https://files.cnblogs.com/files/liutongqing/zfb30.bmp'
          }, {
            type: 'wechat',
            qrImg: 'https://files.cnblogs.com/files/liutongqing/wx30.bmp'
          }
        ]
      }).init()
      </script>
    

    这里参考了greedying大神的作品,github地址,感谢。

    这段代码应该放在【页首Html代码】。

  • 相关阅读:
    数据驱动ddt简单使用
    html-testRunner在unittest测试套件中的使用
    Python设计模式----3.单例模式
    Python设计模式----2.工厂模式
    Python设计模式----1.简单工厂模式
    在小程序中对图片进行缩放时发生的问题记录
    将项目发布到Maven中央仓库的不完整纪要
    虚机的SQL Server空间占满之后进行释放的一些操作
    jdk8环境下,添加重复注解的美好体验
    使用transient关键字解决ehcache序列化错误
  • 原文地址:https://www.cnblogs.com/liutongqing/p/7745413.html
Copyright © 2011-2022 走看看