zoukankan      html  css  js  c++  java
  • 博客园CSS样式

    1.蓝色标题

    如图示例:

    插入页面定制CSS代码中:

    #cnblogs_post_body h3 {
        border-left: 5px solid #21759b;
        border-right: 5px solid #21759b;
        
        background: transparent
            url(http://images.cnblogs.com/cnblogs_com/Renyi-Fan/1188097/o_11.png)
            repeat scroll 0% 0%;
        
        /* background: linear-gradient(-30deg, rgb(241, 226, 198),
            rgb(242, 226, 198) 30%, rgb(243, 227, 198) 60%, rgb(244, 230, 189)
            100%); */
        border-radius: 6px 6px 6px 6px !important;
        font-size: 16px;
        font-weight: bold;
        height: 22px;
        line-height: 22px;
        padding: 5px 0 3px 15px;
        box-shadow: 0 0 0 1px #5F5A4B, 0px 0px 6px 0px rgba(10, 10, 0, 0.5);
    }
    
    #cnblogs_post_body h1 {
        font-size: 250%;
        color: #8888FF;
        /* box-shadow: 0 0 0 1px #5F5A4B, 0px 0px 6px 0px rgba(10, 10, 0, 0.5); */
        text-shadow: 1px 1px 1px #222222;
        /* padding: 5px 0 5px 20px; */
        margin:0px 0px 15px 0px;
    }
    
    #cnblogs_post_body h4 {
        border-left: 3px solid #8888FF;
        border-right: 3px solid #8888FF;
        border-radius: 4px 4px 4px 4px !important;
        background: #00dd99;
        color: #8888FF;
        padding: 3px 0 3px 18px;
        font-size: 14px;
        font-weight: bold;
        height: 17px;
        line-height: 17px;
    }
    
    #cnblogs_post_body h5 {
        border-left: 3px solid #00dd99;
        color: #FB02F9;
        padding: 3px 0 3px 21px;
        font-size: 12px;
        font-weight: bold;
        height: 14px;
        line-height: 14px;
    }
    
    #cnblogs_post_body h2 {
        background: #2B6695 !important;
        border-radius: 6px 6px 6px 6px !important;
        box-shadow: 0 0 0 1px #5F5A4B, 1px 1px 6px 1px rgba(10, 10, 0, 0.5);
        color: #FFFFFF;
        font-family: "微软雅黑", "宋体", "黑体", Arial;
        font-size: 17px;
        font-weight: bold;
        height: 25px;
        line-height: 25px;
        margin: 15px 0 !important;
        padding: 5px 0 5px 20px;
        text-shadow: 2px 2px 3px #222222;
    }

    2.橙色标题

    如图示例:

    插入页面定制CSS代码中:

    #cnblogs_post_body h3 {
        border-left: 5px solid #21759b;
        //border-right: 5px solid #21759b;
        background: transparent
        url(https://images.cnblogs.com/cnblogs_com/Renyi-Fan/1188097/o_33.png)
        repeat scroll 0% 0%;
        /* background: linear-gradient(-30deg, rgb(241, 226, 198),
            rgb(242, 226, 198) 30%, rgb(243, 227, 198) 60%, rgb(244, 230, 189)
            100%); */
        border-radius: 6px 6px 6px 6px !important;
        font-size: 16px;
        font-weight: bold;
        padding: 5px 0 3px 15px;
        box-shadow: 0 0 0 1px #5F5A4B, 0px 0px 6px 0px rgba(10, 10, 0, 0.5);
        color:#FF0000 !important;
        box-shadow: 0 0 8px #aaa;
    }
    
    #cnblogs_post_body h1 {
        font-size: 250%;
        color: #EC7E41;
        /* box-shadow: 0 0 0 1px #5F5A4B, 0px 0px 6px 0px rgba(10, 10, 0, 0.5); */
        text-shadow: 1px 1px 1px #ddd;
        /* padding: 5px 0 5px 20px; */
        margin: 0px 0px 15px 0px;
    }
    
    #cnblogs_post_body h4 {
        border-left: 3px solid #8888FF;
        border-right: 3px solid #8888FF;
        border-radius: 4px 4px 4px 4px !important;
        background: #C6E2FF;
        padding: 3px 0 3px 18px;
        font-size: 14px;
        font-weight: bold;
    }
    
    #cnblogs_post_body h5 {
        border-left: 3px solid #00dd99;
        color: #FB02F9;
        padding: 3px 0 3px 21px;
        font-size: 12px;
        font-weight: bold;
    }
    
    #cnblogs_post_body h2 {
        background:  transparent
        url(https://images.cnblogs.com/cnblogs_com/Renyi-Fan/1188097/o_44.png)
        repeat scroll 0% 0% !important;
        border-radius: 6px 6px 6px 6px !important;
        box-shadow: 0 0 0 1px #5F5A4B, 1px 1px 6px 1px rgba(10, 10, 0, 0.5);
        border:5px solid transparent;
        border-image:url(https://images.cnblogs.com/cnblogs_com/Renyi-Fan/1188097/o_carton13.jpg) 10 10 stretch;
        color: #FFFFFF;
        font-family: "寰�蒋闆呴粦", "瀹嬩綋", "榛戜綋", Arial;
        font-size: 23px;
        font-weight: bold;
        margin: 15px 0 !important;
        padding: 0px 0px 0px 5px;
        /*text-shadow: 0px 0px 3px #222222;*/
        color:#000000 !important;
        box-shadow: 0 0 8px #aaa;
    }

    3.页面点击爱心特效

    如图示例:

    插入博客侧边栏公告框(支持HTML代码),请先申请JS权限!

    <!-- 爱心特效 -->
    <script type="text/javascript">
     
    (function(window,document,undefined){
            var hearts = [];
            window.requestAnimationFrame = (function(){
                    return window.requestAnimationFrame ||
                               window.webkitRequestAnimationFrame ||
                               window.mozRequestAnimationFrame ||
                               window.oRequestAnimationFrame ||
                               window.msRequestAnimationFrame ||
                               function (callback){
                                       setTimeout(callback,1000/60);
                               }
            })();
            init();
            function init(){
                    css(".heart{ 10px;height: 10px;position: fixed;background: #f00;transform: rotate(45deg);-webkit-transform: rotate(45deg);-moz-transform: rotate(45deg);}.heart:after,.heart:before{content: ''; inherit;height: inherit;background: inherit;border-radius: 50%;-webkit-border-radius: 50%;-moz-border-radius: 50%;position: absolute;}.heart:after{top: -5px;}.heart:before{left: -5px;}");
                    attachEvent();
                    gameloop();
            }
            function gameloop(){
                    for(var i=0;i<hearts.length;i++){
                        if(hearts[i].alpha <=0){
                                document.body.removeChild(hearts[i].el);
                                hearts.splice(i,1);
                                continue;
                        }
                        hearts[i].y--;
                        hearts[i].scale += 0.004;
                        hearts[i].alpha -= 0.013;
                        hearts[i].el.style.cssText = "left:"+hearts[i].x+"px;top:"+hearts[i].y+"px;opacity:"+hearts[i].alpha+";transform:scale("+hearts[i].scale+","+hearts[i].scale+") rotate(45deg);background:"+hearts[i].color;
                }
                requestAnimationFrame(gameloop);
            }
            function attachEvent(){
                    var old = typeof window.onclick==="function" && window.onclick;
                    window.onclick = function(event){
                            old && old();
                            createHeart(event);
                    }
            }
            function createHeart(event){
                var d = document.createElement("div");
                d.className = "heart";
                hearts.push({
                        el : d,
                        x : event.clientX - 5,
                        y : event.clientY - 5,
                        scale : 1,
                        alpha : 1,
                        color : randomColor()
                });
                document.body.appendChild(d);
        }
        function css(css){
                var style = document.createElement("style");
                    style.type="text/css";
                    try{
                        style.appendChild(document.createTextNode(css));
                    }catch(ex){
                        style.styleSheet.cssText = css;
                    }
                    document.getElementsByTagName('head')[0].appendChild(style);
        }
            function randomColor(){
                    return "rgb("+(~~(Math.random()*255))+","+(~~(Math.random()*255))+","+(~~(Math.random()*255))+")";
            }
    })(window,document);
     
    </script>

    4.生成目录索引

    插入页脚Html代码框中

    <script language="javascript" type="text/javascript">
    // 生成目录索引列表
    // ref: http://www.cnblogs.com/wangqiguo/p/4355032.html
    // modified by: zzq
    function GenerateContentList()
    {
        var mainContent = $('#cnblogs_post_body');
        var h2_list = $('#cnblogs_post_body h2');//如果你的章节标题不是h2,只需要将这里的h2换掉即可
    
        if(mainContent.length < 1)
            return;
     
        if(h2_list.length>0)
        {
            var content = '<a name="_labelTop"></a>';
            content += '<div id="navCategory" style="color:#268FA6;">';
            content += '<p style="font-size:18px;"><b>目录</b></p>';
            content += '<ul>';
            for(var i=0; i<h2_list.length; i++)
            {
                var go_to_top = '<div style="text-align: right;"><a href="#_labelTop" style="color:#268FA6">Top</a><a name="_label' + i + '"></a></div>';
                $(h2_list[i]).before(go_to_top);
                
                var h3_list = $(h2_list[i]).nextAll("h3");
                var li3_content = '';
                for(var j=0; j<h3_list.length; j++)
                {
                    var tmp = $(h3_list[j]).prevAll('h2').first();
                    if(!tmp.is(h2_list[i]))
                        break;
                    var li3_anchor = '<a name="_label' + i + '_' + j + '"></a>';
                    $(h3_list[j]).before(li3_anchor);
                    li3_content += '<li><a href="#_label' + i + '_' + j + '" style="color:#268FA6" >' + $(h3_list[j]).text() + '</a></li>';
                }
                
                var li2_content = '';
                if(li3_content.length > 0)
                    li2_content = '<li><a href="#_label' + i + '" style="color:#268FA6">' + $(h2_list[i]).text() + '</a><ul>' + li3_content + '</ul></li>';
                else
                    li2_content = '<li><a href="#_label' + i + '" style="color:#268FA6">' + $(h2_list[i]).text() + '</a></li>';
                content += li2_content;
            }
            content += '</ul>';
            content += '</div><p>&nbsp;</p>';
            content += '<hr style="height:1px;border:none;border-top:1px dashed #0066CC;"/>';
            if($('#cnblogs_post_body').length != 0 )
            {
                $($('#cnblogs_post_body')[0]).prepend(content);
            }
        }   
    }
    
    GenerateContentList();
    </script>
  • 相关阅读:
    dubbo、dubbox、motan、thrift、grpc等RPC框架比较及选型
    web攻击之八:溢出攻击(nginx服务器防sql注入/溢出攻击/spam及禁User-agents)
    crontab的安装及crontab命令介绍
    开启Nginx的gzip压缩功能详解
    nginx限制请求之四:目录进行IP限制
    nginx上传目录配置,禁止执行权限
    EhCache 分布式缓存/缓存集群
    Nginx 反向代理、负载均衡、页面缓存、URL重写、读写分离及简单双机热备详解
    CDN模式介绍
    IT基础架构规划方案一(网络系统规划)
  • 原文地址:https://www.cnblogs.com/csyzlm/p/11677190.html
Copyright © 2011-2022 走看看