When you say .snip:first-child
, you are looking for something that both has the snip
class and is the first child of its parent. In your table, the first row with the snip
class is the third child, so the selector doesn't work.
Directly selecting things the way you're trying to won't be possible until selectors level 4 comes out, so at the moment your best bet is to try to combine sibling selectors (+
and ~
) with pseudo selectors. What exactly you do depends on how complicated your use case is.
The simplest solution for your example would be:
tr + tr.snip {
display: none;
}
If necessary, you could also try something like:
tr:not(.snip) + tr.snip {
display: none;
}
Or you could do it in reverse:
tr.snip {
display: none;
}
tr.snip + tr.snip {
display: table-cell;
}
Or (if this is more appropriate):
tr.snip {
display: none;
}
tr.snip ~ tr {
display: table-cell;
}