Consider the code snippet provided 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 objective is to target the a
elements inside the parent ul
tags, excluding the nested ul
within li
.
I have searched through various resources but have not found a CSS solution for this problem.
Could someone please assist me in resolving this issue?