Css not working for alternating row in table for html to pdf template in jsreport
-
th { text-align: center; height: fit-content; width: fit-content; color: white; background: linear-gradient(to bottom, #1F1C18, #8E0E00); font-weight: bold; } td { text-align: center; height: 3.7rem; color: #000; border-left: 0.2rem dashed #c5bebe; border-right: 0.2rem dashed #c5bebe; border-bottom: 0.2rem dashed #c5bebe; border-collapse: collapse; font-weight: bold; } footer { font-size: small; font-family: 'Franklin Gothic Medium', 'Arial Narrow', Arial, sans-serif; } header { width: 100%; padding-top: 1.6rem; font-family: 'Franklin Gothic Medium', 'Arial Narrow', Arial, sans-serif; text-align: center; } main { width: 100%; border-radius: 8px; border-width: 1px; border-style: solid; border-image: linear-gradient(to right, #FFC371, #FF5F6D) 1; } .table-bordered tbody tr:nth-child(even) { background-color: #ff7676; } <tbody> {{#each data}} {{#if auctionId}} <tr> <td> {{auctionId}} </td> <td> {{auctionDescription}} </td> <td> {{displayName}} </td> <td> {{loginId}} </td> <td> {{city}} </td> <td> {{address}} </td> <td> {{startTime}} </td> <td> {{endTime}} </td> <td> {{totalBidCount}} </td> <td> {{bidBasis}} </td> <td> {{winningPrice}} </td> <td> {{bidderCount}} </td> <td> {{totalBidValue}} </td> <td> {{askedBidQty}} </td> <td> {{catalogAcceptanceNumber}} </td> </tr> {{/if}} </tbody>
-
Please share minimal playground demo and describe what means "not working".
https://playground.jsreport.net/
-
this style solved it somehow ->
th { text-align: center; height: fit-content; width: fit-content; color: white; background: linear-gradient(to bottom, #1F1C18, #8E0E00); font-weight: bold; } td { text-align: center; height: 3.7rem; color: #000; border-left: 0.2rem solid #c5bebe; border-right: 0.2rem solid #c5bebe; border-bottom: 0.2rem solid #c5bebe; border-collapse: collapse; font-weight: bold; } tbody > tr:nth-child(odd) { background-color: rgb(233, 233, 233); } tbody > tr:nth-child(even) { background-color: rgb(161, 205, 255); } footer { font-size: small; font-family: 'Franklin Gothic Medium', 'Arial Narrow', Arial, sans-serif; } header { width: 100%; padding-top: 1.6rem; font-family: 'Franklin Gothic Medium', 'Arial Narrow', Arial, sans-serif; text-align: center; } main { width: 100%; border-radius: 8px; border-width: 1px; border-style: solid; border-image: linear-gradient(to right, #FFC371, #FF5F6D) 1; }