zoukankan      html  css  js  c++  java
  • css3新增选择器

    一、css3之前的选择器

    1. ID选择器
    2. 类选择器
    3. 包含选择器(E F)
    4. 伪类选择器(:link,visited,hover,active,focus,first-child)
    5. 伪元素选择器(::first-line,first-letter,before,after)
    6. 通配选择器(.)
    7. 属性选择器(foo[name='martin'])
    8. 子包含选择器(E>F)
    9. 相邻兄弟选择器(E+F)

    二、css3新增选择器

    新增属性选择器:

    1. E[foo^='bar'] 匹配E元素,该元素包含foo属性,且foo属性值以bar开头
    2. E[foo$='bar'] 匹配E元素,该元素包含foo属性,且foo属性值以bar结尾
    3. E[foo*='bar'] 匹配E元素,该元素包含foo属性,且foo属性值包含bar字符串

    新增结构伪类选择器:

    1. E:root 匹配文档所在的根元素
    2. E:nth-child(n) 匹配E所在父元素第n个匹配E的元素,非E的子元素也参与排序,若第n个子元素不是E元素,则该语句没有效果(注意这里的n从1开始)
    3. E:nth-last-child(n) 匹配E所在父元素倒数第n个匹配E的元素
    4. E:nth-of-type(n) 匹配E所在父元素第n个匹配E的元素,非E的子元素不参与排序(n同样是从1开始)注意区别nth-child(n)
    5. E:last-child
    6. E:first-of-type
    7. E:last-of-type
    8. E:only-child
    9. E:only-of-type
    10. E:empty
  • 相关阅读:
    原型链
    原型规则总结
    使用typeof能得到的哪些类型
    eslint 规则中文注释
    两张图片互相切换
    输入框获得焦点与失去焦点、阴影效果
    vue 写table的几种方式
    vue 注意事项
    angular 接口定义封装
    @NgModule
  • 原文地址:https://www.cnblogs.com/liutianzeng/p/10933351.html
Copyright © 2011-2022 走看看