I have one div in my page:
<div id="div1>
welcome
</div>
I need to set background color for this div using css. so i used background-color css in our page, it works as expected but when I try to print it, it is not showing respective color.
So, I tried to use media code. It works in chrome browser but I don't know whether it will work in all browsers.
@media print {
#div1 {
background-color: #E42314 !important;
-webkit-print-color-adjust: exact;
}
}
#div1 {
background-color: #E42314 !important;
}
There is this option in browser's print settings where you need to flip the "show background colors and images".
Because this is a browser setting, you won't be able to set this through code.
For example if you are using Chrome, the print options will look like this:
For IE, it will look something like this:
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With