What is a CSS Child Selector?
A CSS child selector applies to the elements that are children of another element. A child element is an element that is the immediate or direct descendant of another element. For example all the
- . But any anchors on the
- elements are not children of the
- :
Define child selectors by using two type selectors separated by a greater-than sign (>). li > a { text-decoration : none ; } If you have the following CSS: p > strong { color : purple ; } Think about how it would impact the following HTML:
Text in a div with a strong element inside of it.HTML in a paragraph with a strong element inside of it.
Only the second strong element will be purple.