css中的选择器

属性选择器

  • 属性名选择器
    [attr] { Declarations block }
    
  • 属性名与属性值配对选择器
    [attr=val] { Declarations block }
    
  • 属性名与属性值配对选择器(但是值是++以空格作++为分隔符的序列中的一员)
    [attr~=val] { Declarations block }
    
  • 属性名与属性值配对选择器
    (但是值是++以var-作++为开头的字符串)
    [attr|=val] { Declarations block }
    
  • 属性名与属性值配对选择器(但是值是++以var作++为开头的字符串)
    [attr^=val] { Declarations block }
    
  • 属性名与属性值配对选择器(但是值是++以var作++为结尾的字符串)
    [attr$=val] { Declarations block }
    
  • 属性名与属性值配对选择器(但是值中包含++var++的字符串)
    [attr*=val] { Declarations block }
    

伪选择器


关系选择器

  • 后代选择器(A后代中匹配B的. 儿子、儿子的儿子、...)
    selectorA selectorB { Declarations block }
    
  • 父子选择器(A儿子中匹配B的)
    selectorA>selectorB { Declarations block }
    
  • 兄弟选择器(紧接着A的兄弟为B)
    selectorA+selectorB { Declarations block }
    
  • 兄弟选择器(A兄弟中匹配B的)
    selectorA~selectorB { Declarations block }
    

同规则多选器

commSelector1,commSelector2,... { Declarations block }

参考

posted @ 2017-02-28 11:56  逐浪少年  阅读(190)  评论(0编辑  收藏  举报