How to make zebra-striped table continue to other lines

  • lwright4481
    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.

    Thanks.

    How to make zebra striped table continue to other lines Image 1 Screenshot 20

  • Mike_G JotForm Support
    Replied on January 28, 2017 at 4: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.

    How to make zebra striped table continue to other lines Image 1 Screenshot 50

    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.

    How to make zebra striped table continue to other lines Image 2 Screenshot 61

    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.

    How to make zebra striped table continue to other lines Image 3 Screenshot 72

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

    http://stackoverflow.com/questions/2310734/how-to-make-html-text-unselectable

    How to make zebra striped table continue to other lines Image 4 Screenshot 83

    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.