Reputation: 5784
Can you please let me know how I can target an element with a class which has only specific ID?
For example in the following code I need to change the size of only the class which also has the foo ID.
<ul>
<li class="sam">This is not Target</li>
<li class="sam">This is not Target</li>
<li class="sam" id="foo">This is The Target</li>
<li class="sam">This is not Target</li>
<li class="sam">This is not Target</li>
</ul>
I already tried this
#foo .sam {color:green}
but it didn't work. I know that is simply possible in css to target the id element but in this scenarios I have to change the class properties only for that specific item.
Upvotes: 0
Views: 26