I am wondering how to print the html table background color on printer, for example I have html table:
<table border="2">
<tr>
<td bgcolor="#3333FF">&nbsp;</td>
<td>&nbsp;</td>
<td>&nbsp;</td>
</tr>
</table>

From browser I can see backgound color, however if I print it out, the color is gone, is there a way to print this color out?
Thanks for any response.

Dani AI

Generated

Short answer: is on the right track — modern browsers often strip page background colors/images for printing (to save ink and improve legibility), so the colored table you see on-screen won’t necessarily print unless the user allows background graphics in their print dialog. (developer.mozilla.org)

How to fix it from the user side (quick): open Print (Ctrl/Cmd+P) and look for the background option in the print preview. In Chrome it’s under More settings → Background graphics; in Firefox it’s Page Setup / Show details → Print Background (colors & images); in Edge it’s More settings → Background graphics. These are per‑user settings and can’t be reliably toggled from the page itself. (support.digiexam.se)

Developer-side improvements you can try (not guaranteed): add a print rule that asks the UA to preserve colors, and provide a printable class rather than relying on deprecated bgcolor attributes. Example:

@media print and (color) {
  * {
    -webkit-print-color-adjust: exact;
    print-color-adjust: exact;
  }
  .print-bg td { background-color: #3366FF; }
}

This requests exact color printing in supporting engines, but user/browser/printer settings still take precedence — there’s no 100% way to force a user agent to print backgrounds. (developer.mozilla.org)

If you must guarantee the printed result for all users, render a PDF (server-side or via a client PDF export) or use foreground elements (borders, filled images, or inline SVG) so important information isn’t lost when backgrounds are disabled. Also check that the printer is set to print in color (not monochrome) if colors still don’t appear. (fastbridge.illuminateed.com)

I believe it is a br=owser setting

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.