CSS Alternate Rows - some rows hidden

前端 未结 6 1281
遥遥无期
遥遥无期 2021-02-12 11:45

I\'m trying to style a table so that each row is a different colour (odd/even). I have the following CSS:

#woo tr:nth-child(even) td {
    background-color: #f0f         


        
6条回答
  •  不思量自难忘°
    2021-02-12 11:56

    This is a hard problem, I just spent a while playing with CSS2 and 3 selectors, and I'm not sure we're there yet. Something like this should be possible, but doesn't work:

    tr td {background-color:white;}
    tr td:not([style="display:none"]):nth-of-type(even) {
        background-color:#f0f9ff;
    }
    
    1
    2
    3
    

    Seems you're stuck with jQuery's :visible extension (not native CSS), but if it's running slow, definitely paginate the rows as @Ionut says.

提交回复
热议问题