Tuesday, 15 January 2013

javascript - Target unusually numbers with nth-child CSS -



javascript - Target unusually numbers with nth-child CSS -

i don't tend utilize nth-child i've found confusing im wondering if possible target children?

i have list , i'd target 1,3,5,8,10,12 elements only, possible nth-child? have used nth-tester (link) had no luck...

<ul> <li>target</li> <li>item</li> <li>target</li> <li>item</li> <li>target</li> <li>item</li> <li>item</li> <li>target</li> <li>item</li> <li>target</li> <li>item</li> <li>target</li> </ul>

if not possible javascript?

thanks!

you can utilize multiple :nth-child selectors, there's no way combine them.

ul li:nth-child(1), ul li:nth-child(3), ul li:nth-child(5), ... { /* styles */ }

javascript jquery html css css-selectors

No comments:

Post a Comment