print a web page with inline css

778 views Asked by At

I want to print an html table with inline style for particular cells. This is the image of the table.

enter image description here

but when I print this web page out. the colors for those cells disappear. This is the image of the print preview.

enter image description here

This is the code sample of the table:

enter image description here

I know that I can set media type to print for css classes to print those colors out. But there are hundreds of colors available and creating a class for each of them will be a nightmare.

U guys got any solution to print this table with colored cells out?

1

There are 1 answers

0
Jan Mirus On

This was a while ago ... maybe this no longer an issue with today's browsers? They will print background colors if asked to do so. At least it worked for me, and I have pretty much exactly the same situation (inline css generated individually for each cell by PHP). See https://rewordify.com/BackgroundColors.htm