H5新增 input 标签 属性选择器 结构伪类选择器

五、新增 input 标签
h5input.png
六、新增表单属性
newinput.png
七、CSS3 属性选择器(上)
  1. 什么是 CSS3

    • CSS2 的基础上拓展、新增的样式
  2. CSS3 发展现状

    • 移动端支持优于 PC
    • CSS3 目前还草案,在不断改进中
    • CSS3 相对 H5,应用非常广泛
  3. 属性选择器列表


    attrcanshu.png
  4. 属性选择器代码演示

    button {
      cursor: pointer;
    }
    button[disabled] {
      cursor: default
    }
    
八、CSS3 属性选择器(下)
  1. 代码演示

    input[type=search] {
      color: skyblue;
    }
    
    span[class^=black] {
      color: lightgreen;
    }
    
    span[class$=black] {
      color: lightsalmon;
    }
    
    span[class*=black] {
      color: lightseagreen;
    }
    
九、结构伪类选择器
  1. 属性列表


    jiegouweilei.png
  2. 代码演示

    ul li:first-child {
      background-color: lightseagreen;
    }
    
    ul li:last-child {
      background-color: lightcoral;
    }
    
    ul li:nth-child(3) {
      background-color: aqua;
    }
    
十、nth-child 参数详解
  1. nth-child 详解

    • 注意:本质上就是选中第几个子元素

    • n 可以是数字、关键字、公式

    • n 如果是数字,就是选中第几个

    • 常见的关键字有 even 偶数、odd 奇数

    • 常见的公式如下(如果 n 是公式,则从 0 开始计算)

    • 但是第 0 个元素或者超出了元素的个数会被忽略


      nthchildcanshu.png
  2. 代码演示


十一、nth-childnt-of-type 的区别
  1. 代码演示

  1. 区别

    • nth-child 选择父元素里面的第几个子元素,不管是第几个类型
    • nt-of-type 选择指定类型的元素
十二、伪元素选择器
  1. 伪类选择器


    weiyuansu.png
  2. 伪类选择器注意事项

    • beforeafter 必须有 content 属性
    • before 在内容前面,after 在内容后面
    • beforeafter 创建的是一个元素,但是属于行内元素
    • 创建出来的元素在 Dom 中查找不到,所以称为伪元素
    • 伪元素和标签选择器一样,权重为 1
  3. 代码演示

    
    
十三、伪元素的案例
  1. 添加字体图标

    p {
       width: 220px;
       height: 22px;
       border: 1px solid lightseagreen;
       margin: 60px;
       position: relative;
    }
    p::after {
      content: '\ea50';
      font-family: 'icomoon';
      position: absolute;
      top: -1px;
      right: 10px;
    }
    

你可能感兴趣的:(H5新增 input 标签 属性选择器 结构伪类选择器)