nth-child, working only with the html element, nth-child css does not know the class and identifier, if you want to set nth-child for the class, add some custom attribute for this class using jquery ..
as
jQuery('.square:nth-child(3n+3)').attr("act","dummy");
then use css
div[act='dummy']{
border : 1px solid red;}
source
share