CSS: help write selector interlaced illumination without regard to the specific class

Need to do using the lowercase backlight, but to ignore(skip) class .space
The following example should highlight the 2 and 5 line(if at calculation to ignore .space, the 5th becomes the 4th line is even)

doing so
.grid>tbody>tr:not(.space):nth-child(even){background-color:#E6E0C5 !important}

however, nth-child is from a parent ignoring other selectors(in my case :not(.space) )
how can I change the selector to count even went without .space?

of course it is possible to calculate on the server and if I don't find solution I will. However, I would like to know is it possible to do in CSS?
October 8th 19 at 02:31
2 answers
October 8th 19 at 02:33
Yes. To do it really.

But the decision is devoid of any practical meaning, since for reliable operation for each row of the table in which you may receive a grade spacein the css file you will need to add two selectors. Here is a working example.

Here's the styles for the first 3 lines:
tr:not(.space):nth-child(even) { background-color:#E6E0C5; }
tr:not(.space):nth-child(odd) { background-color:#FFF; }

 ~tr:not(.space):nth-child(odd) { background-color:#E6E0C5; }
 ~tr:not(.space):nth-child(even) { background-color:#FFF; }

 ~tr:not(.space):nth-child(even) { background-color:#E6E0C5; }
 ~tr:not(.space):nth-child(odd) { background-color:#FFF; }
really works! regarding practical applications, it may be really a chore
but to expand the horizons and explore the possibilities of css, very interesting solution! - Alvera.Hagen commented on October 8th 19 at 02:36
October 8th 19 at 02:35
As far as I know, the selector nth-child selects only the number of the descendant. The selector nth-of-type is also not correct, because there is nothing to replace tr. If this task is connected with formation of sections in the table, the output can be use for each of your tbody:


Of course, such a table is a little harder to generate, but I still think better than to write class="odd", class="even" to each row, moreover, it will not distortion after dynamic adding or removing of rows in the section.
And there's another drawback: in this case, the next section won't remember what style over the previous one. - Alvera.Hagen commented on October 8th 19 at 02:38
well, if a separate tbody, then the selectors generally lose their meaning, because the tbody still have to do on the server, so it's better there and the class to register.
in General, I did so, due to the fact that the rules of the campaign just got more complicated.

but still I wonder is there any css hack for this situation :) - emmitt_Kohl commented on October 8th 19 at 02:41

Find more questions by tags CSS