Print Preview Excludes Background Color
When printing a web page, specified background colors may fail to appear in the print preview. Specifically, a table's assigned background color is not displaying in Chrome's print preview.
The following CSS property has been applied without success:
-webkit-print-color-adjust: exact;
Resolving the Issue
While the CSS property print-color-adjust: exact; functions correctly, there are fundamental troubleshooting steps to ensure the desired CSS takes effect when printing.
Separate Print from Screen CSS:
Increased CSS Specificity:
@media print { tr.vendorListHeading { background-color: #1a4567 !important; print-color-adjust: exact; } } @media print { .vendorListHeading th { color: white !important; } }
The above is the detailed content of Why Doesn't My Table's Background Color Show in Chrome's Print Preview?. For more information, please follow other related articles on the PHP Chinese website!