6

I am facing a problem background color in a tablerow.

<tr style="background-color:#999999">
        <td width="204"> <strong>Opinion</strong></td>
        <td width="62"> <strong>Action</strong></td>
        <td colspan="4"><strong>Ratings</strong></td>
        <td width="54"><strong>Outlook</strong></td>
        <td width="93"><strong>Rating Type</strong></td>
    </tr>

This code working fine

Here is Output

enter image description here

Problem

When I want to take print of this page. background-color of the row is not shown.

enter image description here

Can anyone please help me?

Brian Tompsett - 汤莱恩
  • 5,753
  • 72
  • 57
  • 129
sunny
  • 1,511
  • 5
  • 20
  • 57

3 Answers3

14

add this to tr style

 <style>
  .row{
   background-color:#999999;
   -webkit-print-color-adjust: exact; 
   }
 </style>

<tr class="row">
    <td width="204"> <strong>Opinion</strong></td>
    <td width="62"> <strong>Action</strong></td>
    <td colspan="4"><strong>Ratings</strong></td>
    <td width="54"><strong>Outlook</strong></td>
    <td width="93"><strong>Rating Type</strong></td>
</tr>
1

Try using

<table> <thead> <tr> <th></th> </tr> </thead> <tbody> <tr> <td></td> </tr> </tbody> <table>

structure for table...

and use below type css..

@media print {
tr.vendorListHeading {
    background-color: #999999!important;
    -webkit-print-color-adjust: exact; 
}}

@media print {
    .vendorListHeading th {
    color: white !important;
}}

Hope this helps...

Ajay Makwana
  • 2,330
  • 1
  • 17
  • 32
0

You can also push more settings in the print dialog and check 'Background graphics'

Andrey
  • 44
  • 1
  • 11