How do I Make Firefox Print a Background-Color Style?

后端 未结 8 1032
臣服心动
臣服心动 2020-11-29 08:14

I have some simple CSS:

#someElement {
    background-color:black;
    color:white;
}

It looks ok in the browser, but when I go to print it

8条回答
  •  时光取名叫无心
    2020-11-29 09:01

    This is how I made it to work in my case by adding the below two lines to the particular div. "@@supports (-moz-appearance:meterbar)" is helpful to add styles specific to Firefox.

    -webkit-print-color-adjust: exact; color-adjust: exact;

    @@supports (-moz-appearance:meterbar) {
        .container {
            margin: 0;
            font-size: 0.85em;
            width: 100%;
            -webkit-print-color-adjust: exact;
            color-adjust: exact;
        }
    }
    

提交回复
热议问题