Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Div Text's Color Changes when Printed

I have a div with white text color.

enter image description here

Using css media queries.

@media print {
     .myid_print_duo_name
     {
         z-index: 2;
         position: absolute;
         left: 0px;
         top: 330px;    
         width: 303px;
         height: 28px;
         line-height: 28px;     
         text-align: center;    
         color: white !important; 
         font-weight: bold;
         font-size: 20px;
         font-family: "Times New Roman";     
     }

 }

My text looks like a little bit darker in my print preview.

enter image description here

I thought it was just ok, but then the printed result is really the same in my print preview. Why is it turning a little bit darker?

like image 522
alyssaeliyah Avatar asked Jun 23 '15 05:06

alyssaeliyah


3 Answers

MDN Docs: Adding this below rule will overwrite the user's printer property settings.

@media print {
  .myid_print_duo_name { /* Replace class_name with * to target all elements */
    -webkit-print-color-adjust: exact;
            color-adjust: exact; /* Non-Webkit Browsers */
  }
}
like image 95
m4n0 Avatar answered Sep 24 '22 05:09

m4n0


Try this css, it may help you.

@media print {
     .myid_print_duo_name{ -webkit-print-color-adjust: exact; color:#fff !important;}
}
like image 32
Chirag S Modi Avatar answered Sep 26 '22 05:09

Chirag S Modi


Some browsers have a property called print-color-adjust, which might darkening some colours and lightening others. Try adding these in your CSS:

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

Taken from Smashing's website: http://www.smashingmagazine.com/2013/03/08/tips-and-tricks-for-print-style-sheets/

like image 26
Dane Rossenrode Avatar answered Sep 24 '22 05:09

Dane Rossenrode