Here is a snippet of HTML code:
<ul>
<li class="class1">AFFECTED</li>
<li class="class1 class2">NOT</li>
<li class="class1">NOT</li>
</ul>
<ul>
<li class="class1 class2">NOT</li>
<li class="class1">AFFECTED</li>
<li class="class1">NOT</li>
</ul>
<ul>
<li>NOT</li>
<li class="class1">AFFECTED</li>
<li class="class1">NOT</li>
</ul>
An all-encompassing CSS selector is needed for the first li element of any list that contains only the class1.
- The li elements with additional classes (e.g., class2) should not be affected.
- Only the first li with class1 should be targeted to change its appearance.
- No JavaScript or jQuery solutions are allowed.
- The li elements are floated, so hard coding nth-child is not feasible.
- The code is automatically generated, making it impossible to add or remove custom classes.
Attempts have been made using :not(class2), [class2] :first-child, and :first-of-type selectors with no success.
Thank you!
Solution: http://jsfiddle.net/6hxZa/3/