When we need to select a particular
set of child elements, we use the
space character like this:
Here, div a
will select all a
elements that are the children of a
div
element, even when those a
elements are nested deeper
within the div
:
In the example given above,
all the div
elements'
children that are a
elements
are selected and given an orange colour.
Actually, not children, but descendants are
selected. Descendants include children,
and children's children and so on.
Link 3 and Link 6 are not a descendant
of any div
element and hence are not
orange.
We can combine any number of selectors
with a space:
In the above example,
ul
and li
elements that come
after the h3
, List of seasons
are not descendants of the nav
.
This is why, they are not
affected by the styles.