What is the difference between '>' and a space in CSS selectors?

前端 未结 5 644
野性不改
野性不改 2020-11-27 12:30

What\'s the point using this syntax

div.card > div.name

What\'s the difference between this

div.card div.name

5条回答
  •  难免孤独
    2020-11-27 13:15

    A > B selects B if it's a direct children of A, whereas A B selects B whether it is a direct children of B or not.

    USING SPACE

    a
    a b
    a b c


    USING GREATER THAN SIGN

    x
    x y
    x y z

提交回复
热议问题