I want a table with several alternating colors, depending on what class they have. Like, after the thead I have some rows with class monday that have #123 and #234, then a few rows with class tuesday have #321 and #432 and so on.
I’m drawing blanks in my head at the moment. Can anyone shed a light on this?
EDIT: Never mind.
.monday:nth-child(even){
background: #123;
are you trying to set background according to the even or odd.
if yes .then you can do it by using javascript.
create a function to check that text is even or odd.
if it is even then return the color you want for even number.
else return the color you want for odd number.
try to get all Elements with class monday using document.getElementsByClassName('monday') and store it in a variable. then using for loop get innerHTML of all element
and check the innerHTML is even or odd using the function you created before and store the value return by the function in a variable.
and inside the for loop set style.background for each element according to the color returned by the function.