Div odd and even
问题 I have a problem that i believe to have a simple fix I just don't know the fix myself. Say i have some divs i.e. <div class="box-1"></div> <div class="box-2"></div> <div class="box-3"></div> <div class="box-4"></div> etc. If these boxes need to be alternate colours. I need to create some css which basically does the following: .box-(odd-number) { color:#000; } .box-(even-number) { color:#fff; } Obviously I know the above is not the correct syntax. Could some one point me in the right