Table style question

I’m not good in CSS… :frowning:
I use the blueprint CSS framework for my sites. There’s a line for formatting tables


tbody tr:nth-child(even) td, tbody tr.even td {background:#ff0000;}

and it is formatting the tables (<table>) like that : the 1st, 3rd, 5th, etc rows have red background which is in some cases OK and I don’t want to change them. BUT, in some cases I want simple tables with WHITE background but I’m simply stupid to create a css rule for that… :injured:
Have tried


tbody.white tr:nth-child(even) td, tbody tr.even td {background:#ffffff;}

and several similar ways… the table doesn’t listen to all those rules I created, it simply have the bloody RED background… I can’t get rid of it. PLZ someone help me…

Looks like that should work, as long as you have class=“white” on the relevant tbody element.

However, rather than apply a row color to all tables and then try to remove it again, I’d probably add a special class to the original rule, and then apply that class to any table that does have colored rows. Then you don’t need a special rule at all for those tables that are just white.

Yeah, that all sounds very logic, BUT as I said I don’t know CSS and I don’t know how to create a special class to the original rule… :frowning:

I’m sure you do, as you basically did do it by copying the rule and adding a class to it. So, you could take the original rule and add the classes:

tbody[COLOR="Red"].stripe[/COLOR] tr:nth-child(even) td, tbody[COLOR="Red"].stripe[/COLOR] tr.even td {background:#ff0000;}

So now the rule will only apply to a tbody that has a .stripe class on it.

<tbody class="stripe">

Thank you ralph! I suppose I was too tired (lazy…) to look at the code and think…
Now it will be OK. Thanks again!