CSS中的含义是什么意思?

20 css css-selectors

在IUI css文件中,它们使用以下选择器:

body > *:not(.toolbar)
body > *[selected="true"] 
Run Code Online (Sandbox Code Playgroud)

>,*:not()和*[]是什么意思?

谢谢.

Mar*_*c W 23

>意思是" 是儿童元素 ".所以body > *:not(.toolbar)匹配*:not(.toolbar)是孩子的body.

*:not(.toolbar)匹配任何没有该类的元素.toolbar.

*[selected="true"]匹配selected属性等于的任何元素true.

请记住,最后两个(*:not()并且*[]CSS3规范的一部分,你通常不能依赖它们来实现跨浏览器的CSS兼容性.但是,WebKit完全支持它们,这就是iPhone(以及iUI)使用.


Dam*_*isa 17

  • > 指直接的孩子
  • * 是一个通用的选择器(一切)
  • :not() 除了括号中的内容之外的任何东西
  • *[] 意味着与括号中的内容相匹配的任何内容

在你的情况下:

body > *:not(.toolbar)   // means any element immediately under the body tag that isn't of class .toolbar
body > *[selected="true"]    // means any element immediately under the body tag where the selected attribute is "true"
Run Code Online (Sandbox Code Playgroud)

>*在CSS 2.1规范中定义.的:not伪类和[]选择器在所述CSS 3规范定义.

有关详细信息,请参阅:http://www.w3.org/TR/CSS21/selector.htmlhttp://www.w3.org/TR/css3-selectors /.