0

How expert like you would you code an odd & even's tr background to be visible for print.

I tried without success to !important them in @media print

    @media print {
      table > tr:nth-child(odd) {
      background: lightgrey!important;
      }
      table > tr:nth-child(even) {
      background: white!important;
      }
    }

Best

  • Does this answer your question? [Why doesn't table > tr > td work when using the child selector?](https://stackoverflow.com/questions/5568859/why-doesnt-table-tr-td-work-when-using-the-child-selector) – VilleKoo Jan 05 '22 at 10:32
  • 2
    Browsers tend to require the user to set an option which will print backgrounds. See for example https://stackoverflow.com/questions/2392366/print-background-colours-in-chrome – A Haworth Jan 05 '22 at 10:46

1 Answers1

0

Thanks

What works to allow the rest of the code to work was this :


@media print { body { -webkit-print-color-adjust: exact; } }