What does > in CSS mean?

前端 未结 4 1455
醉话见心
醉话见心 2021-02-01 06:00

In the IUI css file, they use the following selectors:

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

What does the >, *:not() and *

4条回答
  •  说谎
    说谎 (楼主)
    2021-02-01 06:28

    • > means a direct child
    • * is a universal selector (everything)
    • :not() means anything except what's in the parentheses
    • *[] means anything that matches what's in the brackets

    In your case:

    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"
    

    > and * are defined in the CSS 2.1 specification. The :not pseudo class and the [] selector are defined in the CSS 3 specification.

    See: http://www.w3.org/TR/CSS21/selector.html and http://www.w3.org/TR/css3-selectors/ for more info.

提交回复
热议问题