Click here to Skip to main content
Rate this: bad
good
Please Sign up or sign in to vote.
See more: ASP.NET C#4.0
Suppose I have some text which is displayed over an image or some other printable colours. Is it possible to force this text to white when printing? The default behaviour is to force white to black or grey in most browsers.
Posted 13-Nov-12 1:52am

1 solution

Rate this: bad
good
Please Sign up or sign in to vote.

Solution 1

Yes you can use different media types in your css. Have a look here:
http://www.w3schools.com/css/css_mediatypes.asp[^]
 
Good luck!
  Permalink  
Comments
Member 8911636 at 13-Nov-12 7:40am
   
E.F Nijboer thanx for Quick Response
Kindly explain how i implement these mediatypes on printing "Div"
E.F. Nijboer at 13-Nov-12 10:55am
   
How do you mean? There are plenty examples on w3cschool and you can even try yourself directly on the site itself.
Member 8911636 at 13-Nov-12 11:19am
   
i have tried it.
but not displaying white text in Print out.
it display white in gray...
E.F. Nijboer at 13-Nov-12 13:15pm
   
You have to be somewhat more specific. Can you update your question and add an example of the html and css? Would make it easier to pinpoint the problem.
Rob@Love2Code at 14-Nov-12 11:59am
   
Basically what ever the div class or id is in the html, have that in a media type of print and have the color:black;
 
look at the example on that weblink given by E.F. Nijboer...
 
@media print
{
.my-div-i-want-white-text-to-be-black {font-family:times,serif;font-size:10px;color:black;}
}
E.F. Nijboer at 14-Nov-12 13:13pm
   
Why not simply use this to assign the style to all div elements:
@media print { div {font-family:times,serif;font-size:10px;color:black;} }

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
0 George Jonsson 215
1 Kornfeld Eliyahu Peter 169
2 OriginalGriff 120
3 PIEBALDconsult 110
4 BillWoodruff 85
0 OriginalGriff 6,165
1 DamithSL 4,658
2 Maciej Los 4,087
3 Kornfeld Eliyahu Peter 3,649
4 Sergey Alexandrovich Kryukov 3,294


Advertise | Privacy | Mobile
Web02 | 2.8.141220.1 | Last Updated 13 Nov 2012
Copyright © CodeProject, 1999-2014
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100