I am trying to learn CSS and came across the concept of child selector and descendant selector. To try this out I implemented the following HTML code and linked with the given CSS code.
ol>li {
color: blueviolet;
}
<ol>
<li>first main list item</li>
<li>second main list item</li>
<li>
<ul>
<li>first sub-list item</li>
<li>second sub-list item</li>
</ul>
</li>
</ol>
My expectation was only the main list items to become blueviolet as this has been defined as a child selector. I thought the child selector will only select direct child elements and ignore the second level child elements. But instead, all sub-child and main-child elements became blue violet. Is my understanding wrong about these two selector types?