09 Sep 2020
A child combinator is used to select only the immediate child elements of a parent element, ignoring any nested elements that are further down the HTML tree.
p > a:hover {
color: red;
}
No. The >
symbol is used to select only the direct child a
elements of p
elements, ignoring any nested a
elements that might be inside other elements inside the p
element.
However, if you remove the >
symbol from the CSS selector, like this:
p a:hover {
color: red;
}
Then the CSS selector will select all a
elements that are descendants of p
elements, including any nested a
elements that might be inside other elements inside the p
element.