mzonerz
mzonerz

Reputation: 1260

How to Print HTML table with same header

Hi all I'm facing a problem with printing pages.I want to have same header on all the pages im printing.I read several answers from stack seems no straigt forward answer.

thanks in advance.

Upvotes: 1

Views: 41

Answers (1)

Tom Cash
Tom Cash

Reputation: 148

Add a stylesheet for the printing of the page.

<link type="text/css" href="print.css" rel="stylesheet" media="print">

Then create a div with your hidden print-only header.

<div class="printOnly">Header</div>

Hide the printOnly div in your regular CSS file.

.printOnly { display: none; }

In your print.css, do whatever you need to do to your div. This is also where you would hide otherwise visible properties.

.printOnly { /* Style */ }

This is how I managed print styles.

So, if you have a div called normalHeader that you want gone when you print, simply set the style to display: none; on the print.css file.

Upvotes: 2

Related Questions