Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Alternative for nth-child for older IE browsers

Is there an alternative for targeting elements using nth-child() for older IE browsers?

Javascript (non-jquery) would suffice as well.

EDIT: Given additional libraries cannot be added to the page.

like image 576
Anthony Miller Avatar asked Nov 28 '22 18:11

Anthony Miller


1 Answers

it sucks a little, but you can

ul > li {} /* first-child, overwritten by below */
ul > li + li {} /* second-child, overwritten by below, etc */
ul > li + li + li {}
ul > li + li + li + li {}

Repeat as necessary.

like image 181
WraithKenny Avatar answered Dec 04 '22 07:12

WraithKenny