網誌配置:如何輸入程式碼

0.先加入一個小工具,類型是:javascript
1.小工具程式碼:
<style type='text/css'>
    /* Main Box */
    .pre-highborder{
        border: 1px solid #ff0000;
        padding: 3px 3px 3px 0;
    }
    pre.prettyprint, code.prettyprint {
        border-radius: 8px;
        -moz-border-radius: 8px;
        -webkit-border-radius: 8px;
        padding: 5px;
     overflow: auto;
        background-color: #eee !important;
        color: black;
        box-shadow: 0 0 5px #999;
        -moz-box-shadow: 0 0 5px #999;
        -webkit-box-shadow: 0 0 5px #999;
    }
    /*font*/
    pre span, code span {
        font-family: 'Consolas', 'Courier New', 'Microsoft JhengHei', sans-serif !important;
        font-size: 22px !important;
    }
    /*each line*/
    li.L0, li.L1, li.L2, li.L3, li.L4, li.L5, li.L6, li.L7, li.L8, li.L9 {
        margin: 0 !important;
        padding: 2px 0 2px 4px !important;
        list-style-type:decimal !important;
        border-left: 1px solid #999;
    }
    /*even line*/
    li.L1, li.L3, li.L5, li.L7, li.L9 {
        background-color: #f6f6f6 !important;
    }
    /*odd line*/
    li.L0, li.L2, li.L4, li.L6, li.L8 {
        background-color: #FFF !important;
    }
    /*line-number background color*/
    ol.linenums {
        background-color: #eee;
        margin-left: 20px;
    }
    </style>
     
    <script src="https://cdn.rawgit.com/google/code-prettify/master/loader/run_prettify.js"></script>
2.HTML模式
3.在這中間貼上排版好的程式碼
<pre class="codeblock prettyprint linenums:1">
...code...

</pre>

記得先Encode程式碼!

留言