Issue
I'm trying to select the last child's last child (with text "this one") in a code that looks like this
<div class="block">
<div></div>
<div></div>
<div></div>
<div>
<div></div>
<div></div>
<div>this one</div>
</div>
</div>
I tried .block:last-child:last-child
but it didn't work.
PS: I can't add css classes
Solution
You can use .block div:last-child div:last-child
.block div:last-child div:last-child{
background-color:yellow;
}
<div class="block">
<div>not</div>
<div>not</div>
<div>not</div>
<div>
<div>not</div>
<div>not</div>
<div>this one</div>
</div>
</div>
Answered By - Carsten Løvbo Andersen
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.