Let's take this example code below:
/*ul:first-of-type li a { color: red;}
ul > li a { color: red;}
ul:first-child li a { color: red;}*/
<ul>
<li><a href="">Text</a></li>
<li><a href="">Text</a></li>
<li><a href="">Text</a></li>
<li>
<a href="">Text</a>
<ul>
<li><a href="">Text</a></li>
<li><a href="">Text</a></li>
<li><a href="">Text</a></li>
<li><a href="">Text</a></li>
<li><a href="">Text</a></li>
</ul>
</li>
<li><a href="">Text</a></li>
</ul>
My Goal here is to select the a
tags that are within the parent ul
tags, but not the ul
that is nested within li
.
I have read multiple articles about this but unfortunately couldn't find a solution to do this via CSS.
Can anyone please take a look into this?