zoukankan      html  css  js  c++  java
  • CSS101文章学习

    1.盒模型

    说明: 外边距:margin 内边距:padding 边框 border

    注意:replaced / none-replaced (不可置换的没有margin-top/margin-bottom)

    image

    2.选择器

    #id .class [rel=”nofollow”] :hover

    分享样式与结构 样式重用

    优先级与效率

    !important 高于一切
    style=”” 1,0,0,0
    id 0,1,0,0
    class 属性选择符 伪类 0,0,1,0 同级后来居上
    * 不计分
    继承 没能specificity值,低于*选择器
    @import 通常有冲突时,相同规则 at rule近的优先级都比较低

    示例:

      <style type="text/css">
            .a{color: Green}
            .b{color:Red}
        </style>
        <div id="alipay" class="b a">
            <span>content</span>
        </div>
    输出内容为:Red的content
    <style type="text/css">
           div{color:Green!import;}
           #alipay{color:Blue;}
        </style>
        <div id="alipay" class="b a">
            <span>content</span>
        </div>
    输出内容为:Blue的content
    ID 高效、最快
    class 高效、较快
    属性选择符、伪类 低效、慢
    * 低效、慢

    3.定位

    static(一般) relative(相对定位) absolute(绝对定位) fixed(固定定位)

    position:static 元素默认。影响文档流,占位

    image

    position:relative ;top:60px;left:50px; 影响文档流 占位

    image

    position:absolute 不影响文档流 不占位

    image

    position: fixed 不影响文档流 不占位

    image

    定位:1.基于非static 的父节点定位

             2.fixed基于页面窗口定位

    3.定位在ie6/ie7中有bug

    4.浮动

    float :none right left

    float:none

    image

    浮动会例元素脱离文档,如果浮动后面还有内容的话,元素的框会把浮动忽略,但文本仍会被浮动影响环绕无浮动框

    浮动与定位 清理浮动

    <style type="text/css">
            .clearfix:after
            {
                visibility:hidden;
                display:block;
                font-size:0;
                content:"";
                clear:both;
                height:0;
            }
            .clearfix
            {
                zoom:1;
            }
        </style>
    

    5.规划你的CSS

    浏览器Reset 页面Reset

    image

    模块化 : .module{}

                .module .head{}

                .module .body{}

                .module .foot{}

    6.

    7.css3

    8.工具

  • 相关阅读:
    moment JS 时间操作指南
    react 项目使用 echarts-wordcloud(文字云)
    moment实现计算两个时间的差值
    JS实现回到页面顶部的五种写法(从实现到增强)
    关于谷歌浏览器携带cookie失效解决方案
    Axios发送请求下载文件(重写二进制流文件)
    修改 input / textarea placeholder 属性的颜色和字体大小
    js实现数组浅拷贝和深拷贝
    JS中的可枚举属性与不可枚举属性
    物流管理
  • 原文地址:https://www.cnblogs.com/chenqingwei/p/2005648.html
Copyright © 2011-2022 走看看