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

Randy Mayer picture Randy Mayer · Apr 14, 2010 · Viewed 34.9k times · Source

What's the point using this syntax

div.card > div.name

What's the difference between this

div.card div.name

Answer

Matti Virkkunen picture Matti Virkkunen · Apr 14, 2010

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.