Forum Moderators: not2easy

Message Too Old, No Replies

Print style sheets

replace web header with a print header?

         

4css

2:29 pm on Mar 2, 2006 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



With a print style sheet, is there a way to use two headers.

The site is for a newspaper site and they insist on an extremly large header for the site, which will be printed. The header just overwhelms the page. IMO.

I have designed several headers that are smaller, what I would like to do is present this to them with the ability to print the page with the larger header and have the smaller header for the web portion of the site.

Any help would be greatly appreciated, and thanks in advance!

4~css!

DrDoc

6:51 pm on Mar 2, 2006 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



So, are you talking about some form of image replacement technique, or just display it smaller on the website, but still allow it to be huge in print?

jessejump

8:24 pm on Mar 2, 2006 (gmt 0)

10+ Year Member



Put both headers in the page. Use display: none to leave out the header you don't want to show - 1 for web portion, and 1 for print

4css

10:32 pm on Mar 2, 2006 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Well I suppose it could be an image replacement.

Print style sheet one header, Web style sheet another header. Two different headers.

So in the normal css I would put the normal header, then in the print style sheet the normal would be display none, and then put the larger header?

See, the person wants this giant header, I suppose it is the printed newspaper heading, on the site. Problem is it takes up about 1/4 or so of the page. Making it seem as though the site is saying look at my name and not my content.

I thought if they could see that they could have this one way for print and another for web viewing I could get them to change their minds in regards to the giant header they want. :(

doodlebee

11:08 pm on Mar 4, 2006 (gmt 0)

10+ Year Member



>> Well I suppose it could be an image replacement.<<

for the most part, browser don't print images. So, image replacement in your print stylesheet won't work. You'll have your header graphic in the website - but there's no real way to replace the graphic in the stylesheet, because browsers don't print images.

You can replace it with styled text, but that means you'd have to have the text in the original webite coding, as well (instead of a graphic).

If someone would like to negate me on this, I'd love to hear how to do image replacement for header graphics for print stylesheets, becuase I've been completely unsuccessful in all my endeavors to accomplish the same thing - and all the info I've ever found is "you can't print graphics from a website using a browser."

4css

11:53 pm on Mar 4, 2006 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



[i]because browsers don't print images[i]
Actually it will, I came across a tutorial that explains how to do this.

And the tutorial showed how the print preview etc.. will print the image. You just need to make sure that you don't have your image in percentages. Not that I would put an image in a percentage anyhow. I would use pixels.

If you do a print style sheet and somehow you replace the original header with the one they want to print, it will work.

Take WebmasterWorld for example, look at print preview from your browser, the webmaster world logo would print.

jessejump

12:01 am on Mar 5, 2006 (gmt 0)

10+ Year Member



>>>>>> ability to print the page with the larger header

Put both images on the page

On the Print Styleheet - display:none the web page "portion" image.

On the web portion stylesheet, display:none the large print image.

4css

7:07 pm on Mar 5, 2006 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Hey, thanks, sounds so easy ;)

Appreciate your time!

katana_one

1:07 pm on Mar 6, 2006 (gmt 0)

10+ Year Member



A slightly more elegant solution, in my opinion (and one which does not require two headers in the markup), is to place the print image in the html of the document in its own DIV.

Then in the screen stylesheet, hide the image but place a background image in the DIV that contains the image (and apply height and width to the DIV so it does not collapse on itself).

Then in the print stylesheet, you don't hide the image and don't apply a background image.

Works great on the site I applied this to.

4css

1:51 pm on Mar 6, 2006 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



That is an interesting technique. Only problem being that the image is a bit larger then the web one.

we are trying to convince owner to go with the print style sheet so that we can get the smaller header onto the web instead of one that is almost one quater of the page.

And since the customer is always right, we need to try to swing his/her vote to a different method where they still get what they want, and the web version looks more appealing.

So, there would be some additional editing involved in the print stylesheet.

Hope this makes sense?

katana_one

8:21 pm on Mar 6, 2006 (gmt 0)

10+ Year Member



Actually, the different image sizes are irrelevant. The print image (the larger image) does not display at all, so you set the container DIV to be the same size as the web header, and then set the web header as the background of the DIV. Say the web header is 300 x 100, and the print is 800 x 300.

The HTML would look like this:

<DIV id="header">
<img src="path-to-image/printheader.gif" width=800 height=300>
</DIV>

In the screen stylesheet:

#header {
background:url(path-to-image/webheader.gif) no-repeat;
width:300px;
height:100px;
}
#header img {
display:none;
}

Nothing is required at all in the print stylesheet - the larger image will print by default. This assumes you are using two individual stylesheets, as I did when I set this up for my site.

4css

10:56 pm on Mar 6, 2006 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Thanks katana_one

I was reading something else today, which sounds a bit more complicated from westciv. It talks about using @page?

Isn't the print style sheet better to use and less complicated?

At least to me it seems as though it is.

What font would you recomend for the print styles? And the size? Would 10 or 12pt be better?

katana_one

1:33 pm on Mar 7, 2006 (gmt 0)

10+ Year Member



It talks about using @page?

I have not used @page in my stylesheets yet, so I'm not qualified to answer that.

Isn't the print style sheet better to use and less complicated?

It appears to be simpler, in my opinion. But it also appears that @page, if done right and properly supported by the browser, is much more powerful for print. I guess it would depend on the application.

What font would you recomend for the print styles? And the size? Would 10 or 12pt be better?

There's no right or wrong answer here. Design for your intended audience. In general, I prefer 10pt Times New Roman for print styles. Your milage may vary.

4css

1:58 pm on Mar 9, 2006 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Thanks, appreciate your help and you answers!

doodlebee

7:40 pm on Mar 9, 2006 (gmt 0)

10+ Year Member



4css:

>>Actually it will, I came across a tutorial that explains how to do this.<<

Could you share? 'cause I've been looking for this for quite a while, and have yet to find it! If you can't post a link, at least tell me the google search term to start with so it pops up on the first page when I search! :)

4css

3:05 pm on Mar 10, 2006 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



doodlebee
I'll look up the site and pm you with the information. I have to find the site as I had printed it out and did not bookmark.

Sometime today I'll get that information to you in a sticky.

4~css

doodlebee

3:15 pm on Mar 10, 2006 (gmt 0)

10+ Year Member



thanks :)

4css

4:09 pm on Mar 10, 2006 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



No problem I have several projects (cleaning being one of them :( going on, as soon as I get a breather I will pull out my print outs and sticky the links to you.

4css

12:32 pm on Mar 13, 2006 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



doodlebee, I sent you a sticky regarding the image printing in the style sheets. I gave you several links to different information that I had found while searching this, as well as some search terms to try in case you wished to search for yourself to see what else was out there.

I finally got the print style last night and it worked really really good. The photo printed etc..

Some work was involved as the page was source ordered as well, but I managed to get everything to work out.

In addition to the normal pages they had requested an article type page as well. I had sent them a couple of them, one of which was the same layout as the rest of the site. With the print style sheet, it will work out great. So the whole site should work with the one normal style and the one print style.

heh, so excited that it worked out for me that I had to let you all know, and to thank you all for your help!