简体   繁体   English

如何更改HTML页面的背景色以进行打印?

[英]How to change the background color of a HTML page for printing?

I want to make my website properly printable. 我想使我的网站可正确打印。 The body of the HTML document has a background color other than white. HTML文档的body具有白色以外的背景色。

body {
  background-color: #F8F6F6;
}

The problem is that some parts of the background of the printed page (the margins and the part after the document end) are white as shown below: 问题是打印页面的背景的某些部分(页边距和文档结束后的部分)是白色的,如下所示:

How can I change the color of these areas? 如何更改这些区域的颜色?


Edit (clarification): 编辑(说明):

I want to change the color of white areas in the picture to #F8F6F6 , not the opposite. 我想将图片中白色区域的颜色更改为#F8F6F6 ,而不是相反。

css printing CSS打印

   @media print{
     body {
       background-color: #FFFFFF;
     }
   }

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM