Results 1 to 3 of 3

Thread: CSS print style gives unexpected results

  1. #1
    Join Date
    Aug 2009
    Location
    London
    Posts
    93
    Thanks
    26
    Thanked 0 Times in 0 Posts

    Default CSS print style gives unexpected results

    Hi,

    I am creating a print style sheet (for the first time) but the css & html is not giving the result I require.

    When I print to my HP C3100, the colour backgrounds in the individual cells don't print, although it looks fine on screen.

    Any ideas how I can get it to print with the colour backgrounds?

    For the HTML please visit (too many characters to copy & paste below):

    http://www.johnhathway.co.uk/maplesv..._calendar.html

    Code:
    table { margin-left: 25px; margin-bottom: 15px; border-collapse: collapse; font-size: 12px; text-align: center; font-family: Verdana, Arial, Helvetica, sans-serif; font-weight: normal; color: #ffffff;}
    td, th {
    	padding: .3em .4em;
    	border: 1px #00107f solid;
    }
    thead { background: #00107f; color: #ffffff; }
    tbody { background: #ffffff; color: #00107f; }
    #calendarcolumn { float: left; width: 700px; margin-bottom: 35px; margin-left: 25px; }
    
    .ns { background-color: #e4e4d3; }
    .ns1 { background-color: #e4e4d3; color: #e4e4d3;}
    .hol { background-color: #1e52fc; color: #ffffff;}
    .halfday { background-color: #00107f; color: #ffffff;}
    
    .titleholder { margin-left: 25px; margin-bottom: 15px; color: #000000; font-size: 13px; }

  2. #2
    Join Date
    Mar 2005
    Location
    SE PA USA
    Posts
    30,495
    Thanks
    82
    Thanked 3,449 Times in 3,410 Posts
    Blog Entries
    12

    Default

    I don't think you can. Not without changing some settings for the browser and/or the printer. Skipping background color is one way to save on ink and often improve legibility. I think most browsers have printing of background colors turned off by default, printers generally don't, but at least some can. Depending upon how you have your printer setup, there's a dialogue box with each print job. If this is how your's is setup, somewhere in there may be the option for printing background colors. If not, in control panel you can usually access the printer setup. With the browser, the option is usually on the print preview (page setup, may be represented by an icon, click that, and there's usually a checkbox for background colors), and/or in the browser's options/settings/preferences somewhere.

    From my experience, it's probably the browser. But it can be in the printer's settings, or both.

    I tried with your page, and in print preview the background colors were not there. I set it to print them, and then they were there.

    This is something the user has control of. I don't think you can override it. You could try using the !important keyword, ex:

    Code:
    thead { background: #00107f!important; color: #ffffff; }
    But I don't think that will override the user's browser's settings. I just tried, and it does not work. And as I say, the default in browsers is usually not to print backgrounds. So you might just want to put a note about it on the page. Or offer the content in PDF form, which I imagine might be difficult with this type of thing.

    BTW - That's not a print stylesheet anyway. But in the absence of one, it acts as one.
    Last edited by jscheuer1; 05-18-2011 at 05:09 PM. Reason: Add: I just tried, and it does not work
    - John
    ________________________

    Show Additional Thanks: International Rescue Committee - Donate or: The Ocean Conservancy - Donate or: PayPal - Donate

  3. #3
    Join Date
    Aug 2009
    Location
    London
    Posts
    93
    Thanks
    26
    Thanked 0 Times in 0 Posts

    Default

    Hi,

    Thanks for your reply and suggestions/comments, which I will have a look at.

    I realise that this isn't a print style sheet, just the styles that have been used in the print style sheet (if that makes sense).

    I agree the PDF route might be the best - I might try importing into InDesign.

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •