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.工具

  • 相关阅读:
    centos 搭建ftp服务器
    一种让超大banner图片不拉伸、全屏宽、居中显示的方法
    使用.Htaccess文件实现301重定向常用的七种方法
    Memcached和Memcache安装(64位win7)
    WDCP各种停止重启命令
    php面向对象之构造函数作用与方法
    Yii2.0 rules验证规则大全
    Yii2.0怎么设置时区?
    如何安装PHPstorm并配置php运行环境运行php项
    linux 装composer的出现的问题
  • 原文地址:https://www.cnblogs.com/chenqingwei/p/2005648.html
Copyright © 2011-2022 走看看