views:

37

answers:

2

Is there a way to specify text to appear on the bottom and header of every page when printed?

or

Is there a CSS solution which would allow a header and footer to repeat on each printed page?

thank you

+2  A: 

Although your question is a bit too general, I'm assuming you want that specific text to appear only on your print page and not in your website. Just do a

<p class="print-this">TEXT TO BE SHOWN IN PRINT</p>

then in your print.css

.print-this {
  display: block;
}

and in your main.css

.print-this {
  display: none;
}

Oh and you need to include your stylesheet with the media option as Giu said:

<link rel="stylesheet" type="text/css" href="print.css" media="print" />
<link rel="stylesheet" type="text/css" href="main.css" media="screen" />
corroded
@corroded you should also mention that both `link` elements for including the CSS files should define the appropriate value for the `media` attribute, i.e. for print: `<link rel="stylesheet" type="text/css" href="print.css" media="print" />` and for the screen: `<link rel="stylesheet" type="text/css" href="main.css" media="screen" />`
Giu
@corroded thanks for ur answer , but what i meant was like a header and footer we include in a word document so it prints on every page we print.Hope it makes some sense
manraj82
@Giu, oh yeah sorry i'll add that up. @manraj, yup, you include that html code in every page you have(if you're using a layout like in rails, that's easy since you just need to change one file)
corroded
@corroded no what i meant was Is there a CSS solution which would allow a header and footer to repeat on each printed page?
manraj82
A: 

Using position:fixed, should render on every page when used in a print context

http://css-discuss.incutio.com/wiki/Printing_Headers

pharalia