Use selector +
#myTable tr td {
background-color: red;
}
#myTable tr td + td {
background-color: yellow;
}
#myTable tr td + td + td {
background-color: blue;
}
demo here
EDIT
CSS . , :
#myTable tr th,
#myTable tr td {
background-color: red;
}
#myTable tr th + th,
#myTable tr td + td {
background-color: yellow;
}
#myTable tr th + th + th,
#myTable tr td + td + td {
background-color: blue;
}
EDIT2
javascript , jQuery
$("#myTable th, #myTable td").each(function (i) {
$(this).css('background-color', ['red', 'yellow', 'blue'][i % 3]);
});