开发者

Make printer print out website backgrounds

I created a simple HTML and CSS site for private purposes, but have realized that neither Firefox nor IE show the background color I added when in print preview.

The question is simple: How can I print the website and keep the background color?

For anybody interested, here's the code:

body
{
background-color: rgb(100, 210, 60);
}

I have created a separate style sheet for print media, but that too ignores the background color. I know it's not very ink-friendly to print a whole page a specific c开发者_如何学运维olor, but I would like to enable this for just one time.


I believe this is a client browser specific setting and not controllable by the web developer. Clients have the option to select to show backgrounds. A workaround would be have the image in a layer behind the content.


Printing background colors and images is not set by default. Take a look at this article at css-tricks.com.


Background printing is a printer setting and you can't force it by website. Use images instead.


This is not something that's controlled by your CSS, it is a browser / printer driver setting. In Firefox you'd go into the Page Setup options from Print Preview. In other browsers the location of the option may be different, but it's definitely specific to the program, not your page.


i googled it and i found this paragraph

I suggest you give the content a white background and make the text black. There's no purpose in leaving color (unless you target color printers for some reason). Besides, printers won't print your color background anyway. Remember to also remove background images and watermarks the same way.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜