代码之家  ›  专栏  ›  技术社区  ›  Jon

CSS中的>是什么意思?

  •  22
  • Jon  · 技术社区  · 16 年前

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

    body > *:not(.toolbar)
    body > *[selected="true"] 
    

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

    谢谢。

    4 回复  |  直到 16 年前
        1
  •  23
  •   Marc W    16 年前

    > 意味着“ is a child element of body > *:not(.toolbar) *:not(.toolbar) body .

    .toolbar .

    *[selected="true"] selected 属性等于 true .

    *:not() *[] CSS3 spec 你通常不能依赖它们来实现跨浏览器CSS兼容性。然而,WebKit完全支持它们,而iPhone(以及iUI)也使用WebKit。

        2
  •  17
  •   Community Mohan Dere    12 年前
    • >
    • * 是通用选择器(一切)
    • :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"
    

    > * 在CSS 2.1规范中定义。这 :not 伪类与 [] 选择器在CSS 3规范中定义。

    http://www.w3.org/TR/CSS21/selector.html http://www.w3.org/TR/css3-selectors /了解更多信息。

        3
  •  2
  •   user1558952    13 年前
    • > -子选择器

      也就是

      div > p > b {
       font-size:100px;
      }
      

      这将选择全部 b p 内部标签 div

    • :not(..)

      div:not(.toolbar)
      

      将匹配任何没有类工具栏的div

    • [attr='val']

      这将匹配属性与指定值匹配的任何元素。例如,如果您想将所有选中的复选框都设置为红色。

      input[checkec='true'] {
        background-color:red;
      }
      

        4
  •  1
  •   Jason Plank Maksim Kondratyuk    14 年前

    .cont > div {
        color: #fff;
    }
    

    <div class="cont">
        <!-- NOTE: THIS NOTE IS TO TELL YOU WHICH IT AFFECTS 
             It only affects the below div. Not the p.
             so "jabberwocky" text would be white, but "lorem ipsum" text in the p, would be the default font color. -->
        <div>jabberwocky</div>
        <p>lorem ipsum</p>
    </div>
    
    推荐文章