zoukankan      html  css  js  c++  java
  • 博客园主题修改中用到的css属性

    样式覆盖

    id选择器大于class选择器。

    对于原主题中想要覆盖的id选择器,使用!import覆盖。

    对于原主题中想要取消的css属性,使用inherit.

    响应式

    当屏幕宽度不同时,隐藏部分元素。

    @media (max-1360px) {
        #div_digg {
            bottom: 70px;
            left: 0;
            margin-left: 0;
        }
    }
    @media screen and (max-600px) {
        input#nav_search:focus {
             85px !important;
        }
        input#nav_search { 
            transition: all 0.3s ease-in-out;
            border-bottom: 1px solid #fff;
             40px;
        }
        .hiddenForMobile {
            display: none !important;
        }
    
    }
    

    背景图片自适应

        background-repeat: no-repeat;
        background-attachment:fixed;
        background-position: center center;
        background-size: cover;
    
    

    浮动元素

    position设置为fixed, 为了让组件可以浮动在其他组件之上,设置z-index.

    fuck me on github

    element.style {
        top: 0;
        right: 0;
        border: 0;
        z-index: 100;
        position: fixed;
    }
    

    透明的输入框

    设置backgroundtransparent可以将输入框透明;

    border设为0可以隐藏边框,然后追加bottom样式,注意顺序,后面声明的样式会覆盖前面。

    
    input#nav_search {
        background: transparent;
        transition: all .6s ease-in-out;
        border: 0;
        border-bottom: 1px solid #fff;
        color: #fff;
         5pc;
    }
    

    动画

    css3中同一个元素属性发生变化后可以声明一个变化过程,即transition. transition: all .6s ease-in-out;表示0.6s内完成动画。

    图标库

    引入http://fontawesome.io . 比如search的图标为
    fa fa-search

    组件之间的间距设定

    使用padding和margin来设置间距而不是声明width和hight后调整中心。

    设置div圆角

    #post_detail .postTitle {
        border-top-right-radius: 10px;
        border-top-left-radius: 10px;
    }
    

    设置字体大小

    #post_detail .postTitle {
        font-size: 30px;
        font-weight: 400;
    }
    

    设置立体感的边框

    #post_detail {
        box-shadow: 0 8px 17px 0 rgba(0,0,0,.2), 0 6px 20px 0 rgba(0,0,0,.19);
    }
    

    设置公告的虚线分割

    .my-profile {
        border-bottom: 1px dashed #333;
        padding-bottom: 25px;
        margin-bottom: 25px;
    }
    
    

    设置引用块左侧颜色

    #cnblogs_post_body ul.post-copyright {
        border-left: 3px solid #ff1700;
        background-color: #f9f9f9;
    }
    

    将分类的竖排打乱

    .catListPostCategory li {
        display: inline-block;
    }
    
  • 相关阅读:
    15分钟学会使用Git和远程代码库
    关注的一些个人博客记录
    vue实现筛选功能,文字选中变色
    为博客添加二次元人物方法
    收藏几个用的到的网站
    《代码整洁之道》学习记录
    《架构整洁之道》学习记录
    《指尖上行--移动前端开发进阶之路》学习记录
    《JavaScript设计模式》学习记录
    《以匠心,致设计》学习记录
  • 原文地址:https://www.cnblogs.com/woshimrf/p/cnblogs-customize-css.html
Copyright © 2011-2022 走看看