How to alternate style (background color with jquery) for div inside div with id=”container” alternately ( even and odd ) if I have HTML like this
<div id="container">
<div></div>
<div></div>
<div></div>
<div></div>
...
</div>
I know with table like
#tbl_users tr:nth-child(even) {background: #CCC;}
#tbl_users tr:nth-child(odd) {background: #FFF;}
but how to div apply something like this ?
Did you try:
nth-child should work regardless of the tag.