Page 1 of 1

Cell Background color in Printout

Posted: 2020-04-28 04:48
by uchhavi
Hi,

I have written the following code to change the background color in my form

Code: Select all

<th colspan = "4" style="text-align:center; background-color: #CCCCCC;"><b>DELIVERY & PACKING DETAILS</b></th>
this is working fine on screen, but when i am printing the document, the background color is not appearing.

Please can you help solve this.

Re: Cell Background color in Printout

Posted: 2020-04-28 08:18
by onoehring
Hi,

I suggest you define the CSS in an external stylesheet.
To have the background color in print, you need to add !important to the definition.
try:

Code: Select all

<th colspan = "4" style="text-align:center; background-color: #CCCCCC !important;"><b>DELIVERY & PACKING DETAILS</b></th>
Olaf

Re: Cell Background color in Printout

Posted: 2020-04-28 09:06
by uchhavi
the code u gave is not working... is there any other suggestion u can give?

Re: Cell Background color in Printout

Posted: 2020-04-28 09:17
by jsetzer
As far as I remember the default Bootstrap stylesheet removes many color attributes if @media is print.

Re: Cell Background color in Printout

Posted: 2020-04-28 09:21
by onoehring
Hi,

try to define your own css class with the !important and include that:

Code: Select all

<th colspan = "4" class="YOURCLASS"><b>DELIVERY & PACKING DETAILS</b></th>
und

Code: Select all

YOURCLASS{text-align:center; background-color: #CCCCCC !important;}
Olaf