Since it's a repeating pattern over 8 elements, you can use that to create the CSS:
div:nth-child(8n+1),
div:nth-child(8n+3),
div:nth-child(8n+6),
div:nth-child(8n) {
background-color:black
}
div:nth-child(8n+2),
div:nth-child(8n+4),
div:nth-child(8n+5),
div:nth-child(8n+7) {
background-color:gray
}
Fiddle: http://jsfiddle.net/RvbsL/2/