text changes its color on printing

Discussion in 'CSS' started by Hailstorm, Nov 4, 2009.

  1. #1
    Hello, folks!

    I have a page with the white text and an image in the background. When I print the page (screenshot_browser.jpg), the text all of a sudden changes its color from white to something else (screenshot_print.jpg). I'm totally lost on that one and have no idea why it happens. Attached is my HTML/CSS code (which is just a few lines of). If anyone could take a minute and look into it, I would be very grateful! :)

    Thanks in advance!
    Anton
     

    Attached Files:

    Hailstorm, Nov 4, 2009 IP
  2. twincircuits

    twincircuits Peon

    Messages:
    16
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    0
    #2
    For some reason I'm not quite sure about myself, even with a print.css stylesheet, you can't change the colour of texts.

    What I'd do if you want a custom colour is:
    1. create a file called print.css
    2. set the colour you want to color: white;

    If that fails, just save the text as an image, and place that on there.
     
    twincircuits, Nov 6, 2009 IP
    rob7676 likes this.
  3. Hailstorm

    Hailstorm Peon

    Messages:
    15
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #3
    Thank you for the reply, twincircuits!

    I'm not trying to change the color - it actually changes itself from white to dark-gray when you print out the attached page (either with printer or Adobe Acrobat). What I'm trying to do is to create printable cards, which are basically consist of background image and white text above it. And the problem is that each time the card is printed the reversed out white text prints in black instead of remaining white..
     
    Hailstorm, Nov 6, 2009 IP
  4. rob7676

    rob7676 Peon

    Messages:
    82
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    0
    #4
    twincircuits is correct. When you print a web page some things revert to a default, in this case your font color. Copy your style sheet and save it as print.css and set it to media="print", call it from your web page. When it prints it will use the print stylesheet rather than you main style sheet.
     
    rob7676, Nov 6, 2009 IP
  5. Hailstorm

    Hailstorm Peon

    Messages:
    15
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #5
    Thanks, rob7676, for explaining the trick! But, unfortunatelly, didn't work for me... Updated version of the page is attached to this message... What I'm doing wrong?
     

    Attached Files:

    Hailstorm, Nov 6, 2009 IP
  6. Stomme poes

    Stomme poes Peon

    Messages:
    3,195
    Likes Received:
    136
    Best Answers:
    0
    Trophy Points:
    0
    #6
    I'm not really sure what the point is of telling a printer to print "white". I mean, it's not like they have white ink.
     
    Stomme poes, Nov 8, 2009 IP
  7. deathshadow

    deathshadow Acclaimed Member

    Messages:
    9,732
    Likes Received:
    1,999
    Best Answers:
    253
    Trophy Points:
    515
    #7
    Your problem is that all browsers except Opera are COMPLETE retards when it comes to printing colors (background or foreground) using the default settings.

    Firefox:
    File > Page Setup > Print Background (colors & images)

    IE:
    File > Page Setup > Print background colors and images

    Firefox will always try to override your color choices to black text on a white background unless you change that option.... while IE seems to just pick colors at random.

    Opera defaults to having those options enabled, though they can be disabled if the user likes, Safari and Chrome seems to mimic IE, but do not include an option (that I've been able to find) to make it print what your CSS tells it to.

    I wouldn't mind the behavior when a print.css is not present, but if I'm setting a color in print.css, for **** SAKE USE IT!

    Oh, and you shouldn't need that javascript to hide the button! in your print.css just set #printButton to display:none and it won't print.
     
    Last edited: Nov 8, 2009
    deathshadow, Nov 8, 2009 IP