Matching Descendants, Children, and Siblings
An element name A followed by
another element name B matches
all B elements that are
descendants of A elements. For
example, this rule matches quantity elements that are descendants of ingredients elements, but not other ones
that appear elsewhere in the document:
ingredients quantity {font-size: medium}If the two element names are separated by a greater-than sign (>), then the second element must be an
immediate child of the first in order for the rule to apply. For
example, this rule gives quantity
children of ingredient elements
the same font-size as the
ingredient element:
ingredient > quantity {font-size: inherit}If the two element names are separated by a plus sign (+), then
the second element must be the next sibling element immediately
after the first element. For example, this style rule sets the
border-top-style property for
only the first story element
following a directions
element:
directions + story {border-top-style: solid}