Background colors not printing?
Dec 23, 2007
Today I was working on a little report for work. So I designed a neat xHTML page that has some stats listed in a pretty little table, and then I realize people at work tend to print things out, so I better make a nice print style sheet. So I add my link tag: <link rel="stylesheet" type="text/css" href="/css/print.css" media="print" /> then started working on my print style sheet. Since I use CSS for all the layout all I really need to do is a few of things.
- Remove the non-relevant section such as the page header
- Adjust the browser defaults:
- Remove coloring and underlines from links
- Remove dotted border from abbreviations
- Set my logo image to display as block
- Restyle the table so that alternate rows are different colors
- Add some Javascript to make the link’s url visible
So after doing all these I’m try to do some test prints. In Firefox and Opera everything is fine. Then in Internet Explorer 6 the background color for the alternate table rows isn’t printing. So I’m thinking it’s some sort of IE bug. After spending some time fiddling with the CSS I noticed that which ever element I applied a background color to it wouldn’t print.
Then it hits me… The browser preferences. If you go to the file menu and choose Tools << Internet Options A window will open. Choose the tab called Advanced. Then scroll down to the printing section and check the option “Print background colors and images
”. See Figure 1.

Figure 1
Once you’ve done this your background colors will print.
I also noticed this happens in Safari for Mac. The preference to change this lives in the print dialog. Once your in the print dialog box, expand the dialog by pressing the upside down triangle thing next to the printer you’ve selected.
Then check the box that says “Print Backgrounds
”. See Figure 3.

Figure 3
As a web designer it reminds me that you can’t depend on anything so make sure that your print style sheets do not depend on background colors. For example what if you wanted to have some light grey text or white text on a background color, well if the user has their background colors unchecked, which by default it is, the white text will be printing on white paper. Not good. I guess the lesson here is to test, test, and then do some more testing to make sure everything is working.

4 Comments:
At 8/25/2008 10:31:00 AM ,
Anonymous said...
Thanks for posting this! I was trying to figure out what was wrong with my css. Alas, it was an IE setting.
At 8/26/2008 09:30:00 PM ,
Zeke F. said...
Thanks for the comment. Sometimes we get so in to the code we forget that the problem may be another factor. :)
At 12/11/2008 08:11:00 AM ,
Fredric said...
Well...
I guess this is possible but I think a user wouldn't want to change this setting each time he prints a web page.
I think it is seldomly required to print a page with bg colors/images. Most of the time it is OK, and cost effective, to print webpages without bg colors and images.
If what I think is the case, then a CSS solution is needed. But so far I havn't been able to create one.
At 3/20/2009 04:02:00 AM ,
photoshop image clipping path services said...
Thanks for sharing.
Regards,
Background removal
Post a Comment
<< Home