Hi. thanks to you i solved it , but still i don’t understand it the difference. between li>a{} and li a{}, both still selects the a elements. could you please explain it to me in other words? thanks.
normally we do not encourage people to ask questions in someone else’s topic but since your question is directly related to the original question, I will go ahead and answer it here (but please make a topic for yourself next time when you have a question)
For your question about using the > in the selector. You can think about the elements as being part of a tree. The tree has branches and the branches have smaller branches etc.
So when we say we want ‘all’ elements in the li then that means we want you to go to a specific branch of the tree, in this case the li branch and find every sub-element that is within it that is an anchor. But for a direct child of the element, these are the branches that are coming out the li branch directly (not the branches that come out of other branches that came out from this li branch but a direct child of it).
In coding we can look at a code sample like the one below:
<li>
<a href="www.freecodecamp.org"></a>
<p>words <a href="www.google.com"> other words</a></p>
</li>
The first anchor element is a child of the li so it is selected by >
the second one will not be selected though.
The second anchor element is a child of p element which itself is a child of the li element.
So to select all anchors we must use the li a selector to get them all.
Here’s a reference I like that explains the selectors:
and when i go to the next step, the code becomes automatically
li > a {
color: inherit;
}
so trying again the same step , the error was the missing space.
li>a wrong
li > a correct