I had some issues with the printing the background colors.
print-color-adjust made the background color issue solved in chrome.
body{
-webkit-print-color-adjust: exact;
}
What are the alternate CSS in firefox and IE for this.
I had some issues with the printing the background colors.
print-color-adjust made the background color issue solved in chrome.
body{
-webkit-print-color-adjust: exact;
}
What are the alternate CSS in firefox and IE for this.
Feb 2023 Update: As of mid-2022 onwards, we can simply use print-color-adjust: economy|exact
on the element, without the need to place inside a print media query.
color-adjust
on it's own will become depreciated. (Thank you to misterManSam for the depreciation warning.)
Previous answer (originally from 2016):
As mentioned -webkit-print-color-adjust: exact
is specific to WebKit browsers, including Google's Chrome and Apple's Safari; therefore the code should work adequately in those aforementioned browsers with perhaps slightly varied results (depending on your site/app styling).
There have been proposals to standardize this snippet to work universally for not just browsers but for different devices too. The code is simplified to: color-adjust
. Similarly to the webkit-print-color-adjust
property, the possible values are the same for the proposed property economy | exact
.
If you want to use the property for printing purposes, simply use within a selector inside a @media print
query.
For example:
@media print {
body { color-adjust: exact; }
}
I cannot guarantee the widespread adoption on browsers for the drafted property, however it is currently working on the latest version of FireFox (at the time of writing, version 50.0).
print-color-adjust
and color-adjust
is deprecated. –
Del color-adjust
used in the latest Bootstrap release (5.3.0) cdn.jsdelivr.net/npm/[email protected]/dist/css/bootstrap.css - line 2405? –
Minuscule There is the alternate CSS to print background colors for Chrome And Firefox.
td {
-webkit-print-color-adjust: exact;//:For Chrome
color-adjust: exact;//:For Firefox
}
color-adjust: exact;
works for firefox while the webkit does not. –
Borchert This is beginning to work in Firefox (at least version 48.0.2) with the "color-adjust" property.
td {
background: #000 !important;
-webkit-print-color-adjust: exact;
color-adjust: exact;
}
See https://developer.mozilla.org/en-US/docs/Web/CSS/print-color-adjust#browser_compatibility
print-color-adjust
and color-adjust
;print-color-adjust
and -webkit-print-color-adjust
(edit: https://caniuse.com/?search=print-color-adjust says it only supports -webkit-
version; if anyone actually using Safari can settle this, I'll edit);-webkit-print-color-adjust
.Implemented with the vendor prefix: -webkit-
. How do you know Safari accepts print-color-adjust
? –
Heaps -X-
meaning "Requires a vendor prefix or different name for use". Similarly for Firefox, 48 has "Alternate name: color-adjust" and 97 has "Full support". –
Nierman © 2022 - 2024 — McMap. All rights reserved.