How to make zebra-striped table continue to other lines

  • Profile Image
    Asked on January 28, 2017 at 12:57 PM

    I am making a table and want zebra-striped lines in another color.  I have the CSS code that will make it put one on the top line, but when I click on the + sign to add other rows, the zebra stripe does not follow to the other lines.The CSS I used was: tr:nth-child(even) {background-color: #f2f2f2} HELP would be appreciated.


  • Profile Image
    Answered on January 28, 2017 at 04:53 PM

    The CSS codes you placed actually works, but since the first (col1) and second (col2) td HTML tags are both set to visibility: hidden, the changes are not visible.

    Notice in the screenshot above that only the 3rd and 4th tds are showing the background color set through CSS.


    What you can do is instead of making the visibility of the tds hidden, make the text color transparent and as for the text in the before pseudo make the color of the text black.

    This is the only workaround I can think of for now and this workaround has a drawback, which is if you highlight the text, it will still show you the text(s) that should be hidden.

    To fix that, you can try to use the "user-select:none".

    I hope this helps. If you have any other questions or concerns, please feel free to contact us again anytime so we can help you.

    Thank you.