Print css backgrounds in safari/chrome?

2019-04-21 08:37发布

问题:

I need to print some pages with CSS backgrounds but they don't appear in Safari or Chrome, in FF there's an option in Page Setup but I haven't been able to find it in these two browsers. Do they not support it?

Thanks all in advance.

回答1:

Printing background images is a browser-dependent feature. FF and IE have it but you cannot force it otherwise via sourcecode.



回答2:

In chrome (newer versions 17+ I think), this is controlled by a CSS property on the items which developers can add:

-webkit-print-color-adjust:exact;

From the user's point of view, there doesn't seem to be an option for this.



回答3:

With the newest Chrome, that is an option.

You can also just take a screen shot and print the bitmap image in an image editor or paste the screen shot in Word to print.

Chrome Version 69.0.3497.100 (Official Build) (64-bit)



回答4:

I had this issue again, it was the Twitter Bootstrap CSS causing the issue. When I stopped using Bootstrap, the issue was resolved without any need for the special CSS property (-webkit-print-color-adjust:exact;).