Pattern:
element1 > element2
Definition:
The element1 > element2 selector matches every element2 that is the child of element1. A child selector is made up of two or more selectors separated by ">".
Examples:
Style every <a> that is the child of <p>.
1 | p > a { padding : 10px ; } |
Match every <a> element that is a descendant of <em>; the <em> element must be the child of a <p>; and the <p> element must be a descendant of a <div>.
1 | div p > em a { background-color : gold; } |
Please login to continue.