Forum Moderators: open

Message Too Old, No Replies

Override browser's background printing setting

         

mikegram

6:39 pm on Apr 2, 2002 (gmt 0)

10+ Year Member



I have a small table cell with the background color set. The cell contains an alphanumeric code and together with the background color is significant to the organization of the site.

Like most, I believe, my browser's print options are set to ignore background colors and images so the color doesn't print however the white font on the background does print as a light gray. Is there any way to override the browser's print option for this one table cell? Or at all for that matter?

I'd hate to have to make GIFs for all those codes. There are about 200 of them.

tedster

7:07 am on Apr 3, 2002 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



There is a part of CSS2 that provides for an alternate style sheet to use when printing (or when using any of several other media as well.)

You would create one stylesheet called, say, monitor.css and another called printer.css. Then you call them both from the HEAD like this:

<link rel="stylesheet" type"text/css" href="monitor.css" media="screen">
<link rel="stylesheet" type"text/css" href="printer.css" media="print">

This supported by IE5+ on Windows, IE4.5+ on Mac, and I believe NN6 and Opera6. Netscape 4 did not support alternate media CSS.

Of course, this solution means using css for your colors, rather than table attributes.

(edited by: tedster at 6:48 pm (utc) on April 3, 2002)

mikegram

3:26 pm on Apr 3, 2002 (gmt 0)

10+ Year Member



I'd considered that, but I'm not sure that the CSS targeted to the printer will necessarily override the user's preference not to print background colors.
I will try it and see. Thanks.