Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Table row Background Color not showing when printing

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?

like image 936
sunny Avatar asked Nov 30 '15 06:11

sunny


People also ask

Why is my printer not printing the background color?

First on the File menu, click Options > on the Display menu, click to select the Print background colors and images check box under Printing Options > and then click OK. Hope above suggestion helps you and good luck! Was this reply helpful?

How do you add a background color to a row in a table?

HTML | <tr> bgcolor Attribute The HTML <tr> bgcolor Attribute is used to specify the background color of a table row. It is not supported by HTML 5. Attribute Values: color_name: It sets the background color by using the color name.

Why is my background color not showing up CSS?

that is because you have set the background color, and then overwritten it by using the background shorthand…. either move the background-color call after the background shorthand, or add it TO the shorthand… the browser interprets your current code like this…


1 Answers

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>
like image 103
Saranya Rajendran Avatar answered Nov 15 '22 05:11

Saranya Rajendran