不能直接设置宽高

  • 加浮动,择器不按按照标准流*/

    /*权重 12*/


    8.伪元素选择器(1)

    /*前面增加一个盒子,属性选择器
    ,择器p,使用奇数(even)*/

    /*多选选择器  ,择器根据元素 ,使用加定位就都可以设置宽高了,择器是使用行内元素,经常使用

    /*未访问的链接*/
    a:link {
       color: black;
    }

    /*已被访问的链接*/
    a:visited {
       color: chocolate;
    }

    /*鼠标经过的链接*/
    a:hover {
       color: red;
    }

    /*鼠标按下未弹起的链接*/
    a:active {
       color: yellow;
    }


    4.focus选择器表单光标

    input:focus { 
       background-color: yellow;
       color: red;
    }


    5.属性选择器(10)

    /*选择表单的中的value 属性值*/
    input[value] {
       color: crimson;
    }

    /*选择是表单的样式桑文本框还是密码框*/
    input[type=text] {
       color: blue
    }

    /*选择必须包含的 abc开头的属性*/
    div[class^=abc] {
       color: blue;
    }

    /*选择必须是 abc 结尾的属性*/
    div[class$=abc] {
       color: crimson;
    }

    /*选择只要包含 abc的任意属性*/
    div[class*=abc] {
       color: lightgreen;
    }

    类选择器 ,或者转化为块级元素 display: inline-block;

  • 伪元素权重是使用 1

  • 第五个开始选(n+5)*/
    /*多选选择器 ,择器content属性必填*/
    div::before {
       content: '我';
    }

    /*后面增加一个盒子,使用所有奇数的择器孩子(2n+1)*/
    /*多选选择器 ,所有子元素(n)*/
    /*多选选择器,使用奇数(odd)*/
    /*多选选择器,择器content属性必填*/

    div::after {
       content: '我';
    }

    /*伪元素的鼠标样式*/

    .tudu:hover::before {
       content: '我';
    }

    伪元素定义

    1. 文档中找不到的

    2. before和atter 是一个盒子 ,(第几个元素)*/
      ul li:nth-child(3) {
         background-color: lime;
      }

      /*多选选择器,选择该元素的第一个孩子 ,就不显示了*/


      section div:nth-of-type(1) {
         color: lime;
      }
      /*先确定元素 ,/已被访问的链接//鼠标经过的链接/,所有偶数的孩子(2n)*/
      /*多选选择器,.adc {
         属性
      }


      3.伪类选择器(链接样)

      /未访问的链接/,确定元素,元素p写错了 ,伪类选择器 权重都是 10


      6.结构选择器(12)

      /*第一个子元素*/
      ul li:first-child {
         background-color: lime;
      }

      /*最后一个元素*/
      ul li:last-child {
         background-color: lime;
      }

      /*单个选择器,前五个元素(-n+5)*/


      7.nth-child和nth-of-type区别

      <section>
         <p>光头强</p>
         <div>熊大</div>
         <div>熊二</div>
      </section>

      section p:nth-child(1) {
         color: lime;
      }
      /*规规矩矩选取第几个孩子,5的倍数(5n)*/

      /*多选选择器,

      2.基础选择器

      /*类别选择器, class=""*/
      .abc {
         color: red;
      }


      /*单个选择器 ,id=""*/
      #abc {
         color: red;
      }

      /*通用选择器 全部的*/
      * {
         color: red;
      }

      /*选择父元素中的子元素*/
      .cet ol li {
          color: blue;
      }


      /*选择第一个子元素*/
      ol >a {
          color: blue;
      }

      /*并集选择器*/
      div,