I want to print a colored bootstrap label. When I try to print the HTML page the label have no color, even when I enable the "print background image" option in Chrome. Can someone help me?
Label:
<span class="label label-success">Text</span>
I want to print a colored bootstrap label. When I try to print the HTML page the label have no color, even when I enable the "print background image" option in Chrome. Can someone help me?
Label:
<span class="label label-success">Text</span>
CSS class label-success uses background color CSS property. This property is usually removed by the browser before printing.
Printing background color can be enabled in browser settings, otherwise it cannot be turned on by any CSS rule.
Usually this is workarounded using background images. E.g. see https://defuse.ca/force-print-background.htm
Try this (add normally in styles html tag):
@media print {
.label-warning {
color: #ffffff !important;
background-color: #f39c12 !important;
border-color: #f39c12;
-webkit-print-color-adjust: exact;
color-adjust: exact;
}
}
You can do the above with all others label classes