博客园主题美化

风格不统一 提交于 2019-12-06 10:14:12

主题作者的博客:https://www.cnblogs.com/Dy1an/,感谢作者!

本博客就是使用当前主题,具体效果如下:

页面定制 CSS 代码

* {
    margin: 0;
    padding: 0
}



a {
    text-decoration: none;
    color: #1c2b36
}

body {
    background-color: #fff;
    font-size: 13px;
    letter-spacing: 1px
}

#header {
    background-image: url(https://img2018.cnblogs.com/blog/979767/201911/979767-20191115092708101-1793403956.jpg);
    background-size: cover;
    min-height: 600px;
}

#header::after {
    content: "";
    position: absolute;
    left: 0;
    top: 0;
    right: 0;
    bottom: 0;
    opacity: .8;
    background: #1C1D21;
    height: 600px;
}


#header a,
h1,
img {
    z-index: 1;
    color: white;
    position: relative;
}

#header #blogTitle {
    height: 100px;
    line-height: 100px;
    vertical-align: middle;
    position: relative;
    left: 0;
    right: 0;
    margin: auto;
    width: 1310px;
}

#blogTitle h1>a:after {
    content: "'s OPS BLOG"
}

#blog_nav_sitehome {
    opacity: 0;
}

#header #navigator {
    height: 100px;
    line-height: 100px;
    vertical-align: middle;
    position: relative;
    top: -100px;
    left: 0;
    right: 0;
    margin: auto;
    width: 1310px;
    text-align: right;
}

#header #navigator li>a:hover {
    color: #ea0000
}

#header a {
    letter-spacing: 1px;
}

#header h1 a {
    font-family: Impact;
    letter-spacing: 1px;
}

#header li {
    list-style: none;
    display: inline-block;
}

#header li a {
    font-size: 18px;
    letter-spacing: 2.5px;
    text-transform: uppercase;
    font-weight: 550;
}

#lnkBlogLogo {
    display: none;
}

.blogStats {
    display: none;
}

.my-hd-row {
    height: 400px;
    display: block;
    position: relative;
    top: -100px;
    left: 0;
    right: 0;
    margin: auto;
    width: 1310px;
}

.my-hd-body {
    padding-top: 50px;
}

.my-hd-body-left {
    display: block;
    float: left;
    width: 810px;
    padding: 80px 0;
    height: 340px;
}

.my-hd-body-left h1 {
    color: white;
    letter-spacing: 2px;
    font-size: 34px;
    line-height: 60px;
}

.my-hd-body-right {
    display: block;
    float: right;
    width: 500px;
    height: 340px;
    padding: 80px 0;
    text-align: right;
}

.my-hd-btn {
    margin-top: 70px;
    display: block;
    box-sizing: border-box;
    border: 2px solid #fff;
    border-radius: 30px;
    font-size: 15px;
    font-weight: 600;
    padding: 5px 20px;
    cursor: pointer;
    width: 240px;
}

.my-hd-btn:hover {
    border: 2px solid gold;
    background-color: gold;
    color: #003366 !important;
}

#main {
    position: relative;
    width: 1310px;
    padding-right: 15px;
    padding-left: 15px;
    margin-right: auto;
    margin-left: auto
}

#main .entrylistTitle {
    color:#1c2b36;
}

#mainContent {
    margin-right: 10px;
    width: 900px;
    float: left;
    background-color: white;
    padding: 15px;
    border-radius: 2px
}

#mainContent .forFlow {
    /* border: 1px dashed #ddd; */
    /* background-image: linear-gradient(90deg, rgba(50, 0, 0, 0.04) 3%, rgba(0, 0, 0, 0) 3%), linear-gradient(360deg, rgba(50, 0, 0, 0.04) 3%, rgba(0, 0, 0, 0) 3%); */
    background-size: 20px 20px;
    background-position: center center;
}

#mainContent .day {
    position: relative;
    margin: 0 0 10px 0;
    padding: 15px;
    display: block
}

#mainContent .dayTitle {
    display: none
}

#mainContent .day .postTitle {
    display: inline-block;
    height: 22px;
    line-height: 22px;
    font-size: 20px;
    font-weight: bolder;
    vertical-align: middle;
    border-left: 4px solid #c40000;
    position: relative;
    left: -17px;
    margin-bottom: 15px
}

#mainContent .postTitle>a {
    margin-left: 13px
}

#mainContent .postTitle>a:hover {
    color: #036
}

#mainContent .day .postCon .c_b_p_desc {
    line-height: 23px;
    font-size: 12px;
    opacity: .7;
    margin-bottom: 10px;
    height: 50px;
    overflow: hidden
}

#mainContent .day .postCon .c_b_p_desc:after {
    content: " . . ."
}

#mainContent .day .postCon .c_b_p_desc>a {
    display: none
}

#mainContent .day .postDesc {
    font-size: 12px;
    opacity: .7
}

#mainContent .day .postDesc a:hover {
    color: #ea0000
}

#sideBar {
    width: 340px;
    float: left
}

#sideBar a:hover {
    color: #ea0000
}

#sideBar h3 {
    border-left: 3px solid #cf2730;
    padding-left: 10px;
    margin-bottom: 10px
}

#sideBar .newsItem {
    background-color: white;
    /* background-image: linear-gradient(90deg, rgba(50, 0, 0, 0.04) 3%, rgba(0, 0, 0, 0) 3%), linear-gradient(360deg, rgba(50, 0, 0, 0.04) 3%, rgba(0, 0, 0, 0) 3%); */
    background-size: 20px 20px;
    background-position: center center;
    padding: 15px;
    border-radius: 2px;
    margin-bottom: 10px
}

#profile_block {
    margin-top: 5px
}

#sideBar .newsItem #blog-news {
    line-height: 25px
}

#profile_block {
    padding-top: 10px;
    line-height: 25px
}

#leftcontentcontainer .sidebar-block {
    background-color: white;
    /* background-image: linear-gradient(90deg, rgba(50, 0, 0, 0.04) 3%, rgba(0, 0, 0, 0) 3%), linear-gradient(360deg, rgba(50, 0, 0, 0.04) 3%, rgba(0, 0, 0, 0) 3%); */
    background-size: 20px 20px;
    background-position: center center;
    margin-bottom: 10px;
    padding: 15px
}

#leftcontentcontainer #sidebar_search_box #widget_my_zzk {
    padding-top: 10px;
}

#leftcontentcontainer #sidebar_search_box #widget_my_zzk .input_my_zzk {
    width: 205px;
    height: 28px;
    vertical-align: middle;
    padding: 0 12px;
    font-size: 13px;
    color: #555;
    background-color: #fff;
    background-image: none;
    border: 1px dashed #ccc
}

#leftcontentcontainer #sidebar_search_box #widget_my_zzk .btn_my_zzk {
    line-height: 30px;
    height: 30px;
    vertical-align: middle;
    width: 70px;
    font-weight: 400;
    color: #555;
    text-align: center;
    background-color: white;
    border: 1px dashed #ccc;
    font-size: 13px;
    letter-spacing: 1px
}

#leftcontentcontainer #sidebar_search_box #widget_my_zzk .btn_my_zzk:hover {
    cursor: pointer
}

#leftcontentcontainer #sidebar_categories ul {
    padding-top: 5px;
    list-style: none
}

#leftcontentcontainer #sidebar_categories ul>li {
    line-height: 35px;
}

#leftcontentcontainer #sidebar_categories ul>li:before {
    content: " - "
}

#leftcontentcontainer #sidebar_topviewedposts #TopViewPostsBlock {
    padding-top: 10px;
}

#leftcontentcontainer #sidebar_topviewedposts #TopViewPostsBlock ul {
    list-style: none
}

#leftcontentcontainer #sidebar_topviewedposts #TopViewPostsBlock li {
    line-height: 35px;
    width: 300px;
    text-overflow: ellipsis;
    white-space: nowrap;
    overflow: hidden
}

#leftcontentcontainer #sidebar_topcommentedposts #TopFeedbackPostsBlock {
    padding-top: 10px;
}

#leftcontentcontainer #sidebar_topcommentedposts #TopFeedbackPostsBlock ul {
    list-style: none
}

#leftcontentcontainer #sidebar_topcommentedposts #TopFeedbackPostsBlock li {
    line-height: 35px;
    width: 300px;
    text-overflow: ellipsis;
    white-space: nowrap;
    overflow: hidden
}

#leftcontentcontainer #call_me_box {
    padding-top: 10px;
    border-top: 1px;
    text-align: center
}

#footer {
    margin-top: 10px;
    height: 50px;
    line-height: 50px;
    vertical-align: center;
    text-align: center
}

#mainContent .postBody {
    margin-top: 50px !important
}

#mainContent a:hover {
    color: #ea0000
}

#mainContent .postBody pre {
    padding: 10px
}

#mainContent .postBody table {
    border-spacing: 0;
    width: 100%;
    border-collapse: collapse
}

#mainContent .postBody table thead {
    background-color: #1c2b36
}

#mainContent .postBody table th {
    font-size: 14px;
    font-weight: normal;
    padding: 8px;
    color: white;
    text-align: left;
    border: 1px solid #1c2b36
}

#mainContent .postBody table td {
    font-size: 12px;
    padding: 8px;
    border: 1px solid #ccc
}

#cnblogs_post_body th,
.cnblogs-post-body th {
    background-color: #1c2b36
}

#topics .post .postTitle {
    /* text-align: center; */
    /* padding: 30px 0; */
}

#mainContent .postTitle>a {
    margin-left: 13px;
    /* color: #cf2730; */
}

#topics .post .postBody #cnblogs_post_body {
    padding: 10px
}

#topics .post .postBody #cnblogs_post_body img {
    max-width: 880px;
    /* border: 1px dashed green; */
}

#mainContent .postBody p {
    font-size: 12px;
    letter-spacing: 2px;
    line-height: 30px
}

#cnblogs_post_body {
    margin-bottom: 10px
}

#blog_post_info_block {
    margin-top: 10px
}

#topics .post .postBody #blog_post_info_block {
    padding: 10px
}

#topics .post .postDesc {
    padding: 10px;
    margin-top: 10px
}

#blog-comments-placeholder {
    padding: 10px;
    margin-top: 10px
}

#blog-comments-placeholder br {
    display: none
}

#blog-comments-placeholder .feedback_area_title {
    font-size: 18px;
    font-weight: bold;
    padding-bottom: 10px;
    border-bottom: 1px dashed #ebebeb
}

#blog-comments-placeholder .feedbackItem {
    padding: 10px 0;
    border-bottom: 1px dashed #ebebeb
}

#blog-comments-placeholder .feedbackItem a:hover {
    color: #ea0000
}

#blog-comments-placeholder .feedbackListSubtitle {
    display: inline-block;
    padding: 10px 0
}

#blog-comments-placeholder .feedbackListSubtitle a {
    color: orangered;
    font-weight: bold
}

#blog-comments-placeholder .feedbackManage {
    float: right
}

#blog-comments-placeholder .feedbackManage .comment_actions a {
    padding-left: 5px;
    color: #146a80;
    font-weight: normal
}

#blog-comments-placeholder .feedbackListSubtitle .louzhu {
    color: gold;
    background-color: #1c2b36;
    padding: 1px 10px;
    border-radius: 2px;
    position: relative
}

#blog-comments-placeholder .feedbackManage .comment_actions a:hover {
    color: #ea0000
}

#blog-comments-placeholder .feedbackCon {
    line-height: 30px
}

#blog-comments-placeholder .feedbackCon .comment_vote a {
    padding-right: 5px;
    color: #146a80;
    font-weight: normal
}

#comment_nav {
    padding: 10px;
    margin-top: 10px;
    line-height: 30px
}

#blog-comments-placeholder .feedbackCon .comment_vote a:hover {
    color: #c40000
}

#comment_form #comment_nav a {
    padding-right: 10px;
    color: #146a80
}

#comment_form #comment_nav a:hover {
    color: #ea0000
}

#comment_form_container {
    padding: 10px;
    margin-top: 10px;
    line-height: 30px
}

#comment_form_container #commentform_title {
    font-size: 18px;
    font-weight: bold;
    padding-bottom: 10px;
    border-bottom: 1px dashed #ebebeb
}

#comment_form_container textarea {
    width: 855px;
    height: 150px;
    border: 1px dashed #ebebeb;
    padding: 10px;
    letter-spacing: 1px
}

#comment_form_container #commentbox_opt {
    margin-top: 10px
}

#comment_form_container #commentbox_opt>input {
    margin-bottom: 10px;
    font-weight: 400;
    text-align: center;
    vertical-align: middle;
    cursor: pointer;
    border: 1px solid transparent;
    padding: 5px 10px;
    font-size: 12px;
    line-height: 1.5;
    border-radius: 3px;
    display: block;
    width: 100%;
    background-color: #2f889a;
    color: white
}

#comment_form_container #commentbox_opt>a {
    color: #146a80
}

#ad_t2 {
    display: none
}

#cnblogs_c1 {
    display: none
}

#under_post_news {
    display: none
}

#cnblogs_c2 {
    display: none
}

#under_post_kb {
    display: none
}

.my-title {
    display: block;
    border-left: 5px solid #cf2730;
    padding-left: 10px;
    font-size: 20px !important;
    font-weight: bolder;
    line-height: 40px !important;
    background-color: #f8f8f8;
    color: #1c2b36;
    margin-top: 0px !important;
    margin-bottom: 0px !important;
}

#green_channel {
    padding: 0;
    margin-bottom: 10px;
    margin-top: 10px;
    border: 0;
    font-size: 12px;
    width: 100%;
    text-align: left
}

#author_profile #author_profile_info img {
    border-radius: 50%;
    margin-right: 15px
}

#mainContent .c_b_p_desc {
    line-height: 23px;
    font-size: 12px;
    opacity: .7;
    margin-bottom: 10px;
    height: 50px;
    overflow: hidden
}

#mainContent .day .postSeparator {
    position: relative;
    height: 10px;
    line-height: 10px;
    margin: 15px 0;
    left: -16px;
    width: 898px;
}

#mainContent .c_b_p_desc:after {
    content: " . . ."
}

#mainContent .c_b_p_desc>a {
    display: none
}

#mainContent .entrylistItem {
    position: relative;
    margin: 0 0 10px 0;
    padding: 15px;
    display: block
}

#mainContent .entrylistItem .entrylistPosttitle {
    display: inline-block;
    height: 22px;
    line-height: 22px;
    font-size: 20px;
    font-weight: bolder;
    vertical-align: middle;
    border-left: 4px solid #c40000;
    position: relative;
    left: -17px;
    margin-bottom: 15px
}

#mainContent .entrylistPosttitle>a {
    margin-left: 13px
}

#mainContent .entrylistItem .entrylistItemPostDesc {
    font-size: 12px;
    opacity: .7
}

#mainContent .entrylistItem .entrylistItemPostDesc a:hover {
    color: #ea0000
}

#mainContent .entrylistTitle {
    text-align: center;
    padding-bottom: 30px;
    margin-bottom: 10px
}

blockquote {
    border: 0;
    padding: 5px 20px;
    margin: 0;
    font-size: 14px;
    border-left: 5px solid #eee;
    background-color: #f8f8f8;
}

blockquote pre {
    padding: 5px !important;
    font-size: 14px
}

blockquote pre {
    padding: 5px !important;
    font-size: 14px
}

@media(max-width:970px) {
    #header {
        display: none;
    }

    #blogTitle h1 {
        display: none
    }

    .my-hd-body-right {
        display: none;
    }

    #main {
        top: 0;
        padding-right: 0px;
        padding-left: 0px;
        margin-top: 0px;
    }

    #header {
        min-width: 100% !important;
        padding-left: 0;
        padding-right: 0;
        min-height: 350px;
    }

    .blogStats {
        display: none;
    }

    #header #navigator {
        float: left;
        padding-left: 15px;
    }

    #header li a {
        font-size: 20px;
        font-weight: bolder;
    }

    .my-hd-body-left {
        display: block;
        float: left;
        width: auto;
        padding: 0 15px;
    }
    
    .my-hd-body-left h1 {
        color: white;
        letter-spacing: 2px;
        font-size: 18px;
        line-height: 50px;
    }

    .my-hd-btn {
        display: none;
    }

    #mainContent .day .postSeparator {
        width: 100% !important
    }

    #mainContent {
        margin-right: 0 !important
    }

    #sideBar {
        margin-top: 10px !important;
        margin-left: 0 !important;
        margin-right: 0 !important
    }

    .commentform {
        margin-left: 0 !important;
        margin-right: 0 !important
    }

    #comment_form_container textarea {
        width: 100% !important;
        padding: 0 !important
    }

    #cnblogs_post_body table {
        display: inline !important
    }

    #topics .postTitle a {
        font-size: 20px;
    }

    #topics .post .postBody #cnblogs_post_body img {
        max-width: 100%;
        border: 1px dashed green;
    }

    #mainContent .postBody table td {
        white-space: normal !important
    }

    .commentbox_title_right {
        display: none;
    }

    #mainContent .day .postTitle {
        display: inline-block;
        height: 22px;
        line-height: 22px;
        font-size: 18px;
        font-weight: bolder;
        vertical-align: middle;
        border-left: 4px solid #c40000;
        position: relative;
        left: -17px;
        margin-bottom: 15px;
        width: 100%;
        white-space: nowrap;
        overflow: hidden;
    }

    #mainContent .entrylistItem .entrylistPosttitle {
        display: inline-block;
        height: 22px;
        line-height: 22px;
        font-size: 20px;
        font-weight: bolder;
        vertical-align: middle;
        border-left: 4px solid #c40000;
        position: relative;
        left: -17px;
        margin-bottom: 15px;
        width: 100%;
        white-space: nowrap;
        overflow: hidden;
    }
}

#cnblogs_post_body p {
    margin: 0 !important;
    text-indent: 0;
}

.topicListFooter {
    margin-bottom: 10px;
}

#poweredby {
    display: none;
}

#mainContent {
    border-right: 1px dashed lightgray;
    padding-right: 10px;
}

页首 HTML 代码

<script>
    // 创建一个标签,将标签添加到指定标签里面
    var myEle = '<div class="my-hd-row"><div class="my-hd-body my-hd-body-left"><h1 class="">WELCOME! THIS IS A DOCUMENT WEBSITE RELATED TO OPERATION AND MAINTENANCE WORK.</h1><a class="my-hd-btn" href="https://github.com/senup" target="_blank">VISIT THE GITHUB NOW</a></div><div class="my-hd-body my-hd-body-right"><img class="img-fluid" src="https://img2018.cnblogs.com/blog/979767/201911/979767-20191118181141199-298692443.png" alt="Image" style="height: 300px;"></div></div>'
    document.getElementById('header').insertAdjacentHTML("beforeEnd", myEle);

    var githubEle = '<li><a target="_blank" class="menu" href="https://github.com/senup">GITHUB</a></li>';
    // 四个参数 beforeBegin、 afterBegin、beforeEnd、afterEnd
    document.getElementById('navList').insertAdjacentHTML("beforeEnd", githubEle);


    var callMeEle = '<div id="call_me" class="sidebar-block"><div><h3 class="catListTitle">联系我</h3><div id="call_me_box"><img src="https://images.cnblogs.com/cnblogs_com/senup/1605470/o_191203051539avatar.jpg" alt="" style="width:100px" ></div></div></div>'
    document.getElementById('blog-sidecolumn').insertAdjacentHTML("beforeEnd", callMeEle);
</script>


<script>
    // 点击页面小心心
    (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{width: 10px;height: 10px;position: fixed;background: #f00;transform: rotate(45deg);-webkit-transform: rotate(45deg);-moz-transform: rotate(45deg);}.heart:after,.heart:before{content: '';width: 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>
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!