Generally, you can only target an element, a value of a named attribute in it, or the name of an attribute in the element. So, I would say the answer might be...no? (limited to my own knowledge)
That being said..
Would it be possible to insert an empty <li>
before each item you want to target?
If so, you can easily select those items like so:
ul li {
color: red
}
li:empty {
display: none
}
li:empty + li {
color: green
}
<ul>
<li></li>
<li class="a">1</li> <!-- I want to target this li -->
<li class="a">2</li>
<li class="a">3</li>
<li></li>
<li class="b">4</li> <!-- I want to target this li -->
<li class="b">5</li>
<li class="b">6</li>
</ul>