Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 14 of 14
  1. #1
    Master Coder
    Join Date
    Apr 2003
    Location
    in my house
    Posts
    5,211
    Thanks
    39
    Thanked 201 Times in 197 Posts

    print css - is this specific requirement possible?

    OK I have a css for printing the web page. I want to use an attribute at the beginning to make all elements - display:none; including those called from the normal stylesheet.


    Then I can list those in the print stylesheet that I need to display for printing.

    bazz
    "The day you stop learning is the day you become obsolete"! - my late Dad.

    Why do some people say "I don't know for sure"? If they don't know for sure then, they don't know!
    Useful MySQL resource
    Useful MySQL link

  • #2
    Regular Coder Graft-Creative's Avatar
    Join Date
    Aug 2004
    Location
    Web Designer - North East Lancashire U.K.
    Posts
    842
    Thanks
    0
    Thanked 0 Times in 0 Posts
    this could work:
    Code:
    * { display: none;
    }
    Sets everything not to display.

    Then like you say, go through and select the things you want to display.

    Gary

  • #3
    Master Coder
    Join Date
    Apr 2003
    Location
    in my house
    Posts
    5,211
    Thanks
    39
    Thanked 201 Times in 197 Posts
    yeh it works..... too well It stops everything displaying, including the code that flows below that line.

    Bazz
    "The day you stop learning is the day you become obsolete"! - my late Dad.

    Why do some people say "I don't know for sure"? If they don't know for sure then, they don't know!
    Useful MySQL resource
    Useful MySQL link

  • #4
    Senior Coder
    Join Date
    Nov 2003
    Location
    Minneapolis, MN
    Posts
    2,879
    Thanks
    2
    Thanked 65 Times in 56 Posts
    lol, you get what you ask for...

    I think it does that because the browser figures, "hey, if I don't need anything I'm not going through the trouble of loading anything..." What about "visibility: hidden"?

    I've always wondered about this to tackle some of my more complicated IE stylesheets...

  • #5
    Regular Coder Graft-Creative's Avatar
    Join Date
    Aug 2004
    Location
    Web Designer - North East Lancashire U.K.
    Posts
    842
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Quote Originally Posted by bazz
    yeh it works..... too well It stops everything displaying, including the code that flows below that line.

    Bazz
    could be a good ploy if you ever feel the need to stop folks printing your page, but that's besides the point

  • #6
    Master Coder
    Join Date
    Apr 2003
    Location
    in my house
    Posts
    5,211
    Thanks
    39
    Thanked 201 Times in 197 Posts


    MAybe I didnt ask the right question?

    OK this is the scenario....I am making the components of web pages with perl and they will be inserted into several pages on different websites. What I have found is that when I view print preview, the styles that are included in one stylesheet (for normal browser viewing), and which are not mentioned in the 'printcss.css (to become display none), become displayed anyway in the printable version. I want to ensure that all style stuff is excluded, except for that which is mentioned in the printcss.css stylsheet.

    Whilst I have media="print" stated for the print-specific stylesheet, I have no control over other web-designers, who don't use the display="screen" attributes. I imagine that that would be the best way to achieve what I want but that would take too much toime as the 'designers' around here, all seem to use premade editing software and refuse to think that tables are bad, that doctypes are needed - I think you get the drift...

    So, back on track, does anyone know of a solution for my little dilemma?


    Bazz
    "The day you stop learning is the day you become obsolete"! - my late Dad.

    Why do some people say "I don't know for sure"? If they don't know for sure then, they don't know!
    Useful MySQL resource
    Useful MySQL link

  • #7
    Regular Coder Graft-Creative's Avatar
    Join Date
    Aug 2004
    Location
    Web Designer - North East Lancashire U.K.
    Posts
    842
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Are you sure the serverside includes don't contain the stylesheet link - I've seen this happen with dreamweaver freaks - all their includes contain the full doctype declaration, stylesheet link etc etc - because as they see it when making a file to be included they are just making a new html page - so its menu>new>html page - resulting in the head info being repeated several times throughout a page. Could that be the problem?

    Gary

  • #8
    Senior Coder
    Join Date
    Nov 2003
    Location
    Minneapolis, MN
    Posts
    2,879
    Thanks
    2
    Thanked 65 Times in 56 Posts
    ... and be sure to check if your main css has the "media="screen"" attribute, not "media="all"." I don't know if it makes a difference, but on the site I'm building now, the exact opposite of what you want is happening: My printed pages don't assume any of my main styles, so until I build a separate stylesheet for print, anything printed will be sans style.
    Last edited by rmedek; 02-06-2005 at 10:58 PM.

  • #9
    Master Coder
    Join Date
    Apr 2003
    Location
    in my house
    Posts
    5,211
    Thanks
    39
    Thanked 201 Times in 197 Posts
    Please see my previous post.

    I am providing perl outputted content for inclusion in pages made by other 'web-designers'. I have no control over how they code their page as they argue that tables are the way to do it and that css and doctypes arent necessary. Cripes some even say that there is simply no point in building the page for all those 'wee browsers' coz so few people use them!!!!

    In a nutchell, they haven't even grasped the ability to put media="whatever" in their html. So I need to be able to override it with my print.css and I thought Graft-Creatives idea was good until I applied it and found it worked too well. It prevents from displaying, all the elements including those listed after the display none portion.

    I have a solution which doesn't work, for whenever I know the classes etc for the others' websites - I simply put those into my print css and tell them to display none - individually. That is as I say, verbose but most often I don't know the specific tags they use and its too time consuming for me to check the antics of each site builder.

    Ho Hum... we have a problem.

    Bazz
    [edit]
    PS just another thought...this is an example of why standards are sooo important. code the page wrongly and even in the most used browser, the thing can't work!! I need a lie down - and its only Monday
    Last edited by bazz; 02-07-2005 at 01:22 PM.
    "The day you stop learning is the day you become obsolete"! - my late Dad.

    Why do some people say "I don't know for sure"? If they don't know for sure then, they don't know!
    Useful MySQL resource
    Useful MySQL link

  • #10
    Senior Coder
    Join Date
    Nov 2003
    Location
    Minneapolis, MN
    Posts
    2,879
    Thanks
    2
    Thanked 65 Times in 56 Posts
    Man I am confused now...

    See?

    If you only have control over portions of the total web page (the parts you are including via Perl), then it doesn't matter what trickery you add into the CSS-- chances are there will be something that you won't have control over that will display on a printed page. And how is your print CSS accessed anyway if you don't have control over what's in the <head>?

    The only real solution I can see (other than having Perl rewrite the entire document file) is to make sure that your section of html is marked up as specific as possible, and that the web "developers" add these two lines to every page, in the head section:
    Code:
    <link rel="stylesheet" media="screen, projection" href="/css/style.css" />
    <link rel="stylesheet" media="print" href="/css/print.css" />
    Explain to them it's all you ask of life.

  • #11
    Regular Coder Graft-Creative's Avatar
    Join Date
    Aug 2004
    Location
    Web Designer - North East Lancashire U.K.
    Posts
    842
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Tricky one. To be honest it sounds like you're p*ssing in the wind with this, not your fault obviously. I just can't think of a way you can overide what your designers have done?

    I tried:
    * {display: none;
    }

    In Opera, with a xhtml 1.1 site I have, and was presented with a nice clean times new roman style page.

    Maybe you could use a style switcher, with a print button on the page - using the above method to switch all styles off for the printed version?

    It's not pretty, don't know if it works in IE. If the designers aren't using css for their designs, it's hard to see how you could implement css print styles anyway.

    Gary

  • #12
    Senior Coder
    Join Date
    Nov 2003
    Location
    Minneapolis, MN
    Posts
    2,879
    Thanks
    2
    Thanked 65 Times in 56 Posts
    Hey, I just realized you could go old school with this one:

    <a href="printversion.htm">Print version</a>

    Ugly, but it used to be done that way...

  • #13
    Regular Coder Graft-Creative's Avatar
    Join Date
    Aug 2004
    Location
    Web Designer - North East Lancashire U.K.
    Posts
    842
    Thanks
    0
    Thanked 0 Times in 0 Posts
    good call Richard, but I can't see Bazz's (cough) ultra co-operative (splutter) designers making two versions of the same page.

    Bazz I'm really starting to think this is not your problem mate, of course, you want to do things right, but in the environment you're in I suppose sometimes you have to let things go. I just can't understand why the onus should be on you for what is basically a design issue? if your designers aren't savvy enough to make a print friendly version of thier designs then maybe they should be explaining why not to your boss?

    Gary

  • #14
    Master Coder
    Join Date
    Apr 2003
    Location
    in my house
    Posts
    5,211
    Thanks
    39
    Thanked 201 Times in 197 Posts
    Thanks all.

    I suppose Gary, it just isn't that simple. The designers work for themselves I work for myself and the cllients work for themselves. I am trying to bring better services to the client but the poor design of their sites, makes this even more difficult.

    Edit: was much too long

    Bazz
    Last edited by bazz; 02-09-2005 at 11:48 AM.
    "The day you stop learning is the day you become obsolete"! - my late Dad.

    Why do some people say "I don't know for sure"? If they don't know for sure then, they don't know!
    Useful MySQL resource
    Useful MySQL link


  •  

    Posting Permissions

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