Search code examples
csscss-selectors

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


What's the point using this syntax

div.card > div.name

What's the difference between this

div.card div.name

Solution

  • A > B will only select B that are direct children to A (that is, there are no other elements inbetween).

    A B will select any B that are inside A, even if there are other elements between them.