HTML - Keep a table head on each page sent to printer ?

  • SCRiPTOPSY
  • Newbie
  • Newbie
  • SCRiPTOPSY
  • Posts: 5

Post 3+ Months Ago

Owkey i'm kinda like looking for a quick and dirty way to solve this, I can think of a way in php, but I would like to know if somebody knows an easier & probably more stable way.

Here we go:

If got some database output which is shown in html table, however this page is specially made to be printed. so my question is, is there a way to tell the printer/browser to print the table header (Titles) on each page that will be printed?

the way I figured out in php or any language you are using, is buy counting the specific amount of rules that have been printed, after the page is full print a new header and so on. but this is not handy when changing font etc...
  • Anonymous
  • Bot
  • No Avatar
  • Posts: ?
  • Loc: Ozzuland
  • Status: Online

Post 3+ Months Ago

  • Mas Sehguh
  • Mastermind
  • Mastermind
  • User avatar
  • Posts: 1853

Post 3+ Months Ago

Mozilla does it with all THEADs and TFOOTs; IE requires the CSS properties display:table-header-group / display:table-footer-group to be used explicitly.

Code: [ Select ]
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN"
"http://www.w3.org/TR/REC-html40/strict.dtd">
<html>
<head>
<title>Example</title>
</head>
<body>
<table>
<thead style="display: table-header-group;">

<tr><th>ID</th><th>Username</th><th>Email</th><th>Location</th></tr>

</thead>

<tbody>
<tr><td>1 </td><td>Sam</td><td>dfkjskj</td><td>Town</td></tr>
<tr><td>2 </td><td>Sam</td><td>dfkjskj</td><td>Town</td></tr>
<tr><td>3 </td><td>Sam</td><td>dfkjskj</td><td>Town</td></tr>
<tr><td>4 </td><td>Sam</td><td>dfkjskj</td><td>Town</td></tr>
<tr><td>5 </td><td>Sam</td><td>dfkjskj</td><td>Town</td></tr>
<tr><td>6 </td><td>Sam</td><td>dfkjskj</td><td>Town</td></tr>
<tr><td>7 </td><td>Sam</td><td>dfkjskj</td><td>Town</td></tr>
<tr><td>8 </td><td>Sam</td><td>dfkjskj</td><td>Town</td></tr>
<tr><td>9 </td><td>Sam</td><td>dfkjskj</td><td>Town</td></tr>
<tr><td>10</td><td>Sam</td><td>dfkjskj</td><td>Town</td></tr>
<tr><td>11</td><td>Sam</td><td>dfkjskj</td><td>Town</td></tr>
<tr><td>12</td><td>Sam</td><td>dfkjskj</td><td>Town</td></tr>
<tr><td>13</td><td>Sam</td><td>dfkjskj</td><td>Town</td></tr>
<tr><td>14</td><td>Sam</td><td>dfkjskj</td><td>Town</td></tr>
<tr><td>15</td><td>Sam</td><td>dfkjskj</td><td>Town</td></tr>
<tr><td>16</td><td>Sam</td><td>dfkjskj</td><td>Town</td></tr>
<tr><td>17</td><td>Sam</td><td>dfkjskj</td><td>Town</td></tr>
<tr><td>18</td><td>Sam</td><td>dfkjskj</td><td>Town</td></tr>

<!-- etcetera -->

</tbody>
</table>


</body>
</html>
  1. <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN"
  2. "http://www.w3.org/TR/REC-html40/strict.dtd">
  3. <html>
  4. <head>
  5. <title>Example</title>
  6. </head>
  7. <body>
  8. <table>
  9. <thead style="display: table-header-group;">
  10. <tr><th>ID</th><th>Username</th><th>Email</th><th>Location</th></tr>
  11. </thead>
  12. <tbody>
  13. <tr><td>1 </td><td>Sam</td><td>dfkjskj</td><td>Town</td></tr>
  14. <tr><td>2 </td><td>Sam</td><td>dfkjskj</td><td>Town</td></tr>
  15. <tr><td>3 </td><td>Sam</td><td>dfkjskj</td><td>Town</td></tr>
  16. <tr><td>4 </td><td>Sam</td><td>dfkjskj</td><td>Town</td></tr>
  17. <tr><td>5 </td><td>Sam</td><td>dfkjskj</td><td>Town</td></tr>
  18. <tr><td>6 </td><td>Sam</td><td>dfkjskj</td><td>Town</td></tr>
  19. <tr><td>7 </td><td>Sam</td><td>dfkjskj</td><td>Town</td></tr>
  20. <tr><td>8 </td><td>Sam</td><td>dfkjskj</td><td>Town</td></tr>
  21. <tr><td>9 </td><td>Sam</td><td>dfkjskj</td><td>Town</td></tr>
  22. <tr><td>10</td><td>Sam</td><td>dfkjskj</td><td>Town</td></tr>
  23. <tr><td>11</td><td>Sam</td><td>dfkjskj</td><td>Town</td></tr>
  24. <tr><td>12</td><td>Sam</td><td>dfkjskj</td><td>Town</td></tr>
  25. <tr><td>13</td><td>Sam</td><td>dfkjskj</td><td>Town</td></tr>
  26. <tr><td>14</td><td>Sam</td><td>dfkjskj</td><td>Town</td></tr>
  27. <tr><td>15</td><td>Sam</td><td>dfkjskj</td><td>Town</td></tr>
  28. <tr><td>16</td><td>Sam</td><td>dfkjskj</td><td>Town</td></tr>
  29. <tr><td>17</td><td>Sam</td><td>dfkjskj</td><td>Town</td></tr>
  30. <tr><td>18</td><td>Sam</td><td>dfkjskj</td><td>Town</td></tr>
  31. <!-- etcetera -->
  32. </tbody>
  33. </table>
  34. </body>
  35. </html>
  • SCRiPTOPSY
  • Newbie
  • Newbie
  • SCRiPTOPSY
  • Posts: 5

Post 3+ Months Ago

thanks you very much mister!

Post Information

  • Total Posts in this topic: 3 posts
  • Users browsing this forum: No registered users and 65 guests
  • You cannot post new topics in this forum
  • You cannot reply to topics in this forum
  • You cannot edit your posts in this forum
  • You cannot delete your posts in this forum
  • You cannot post attachments in this forum
 
cron
 

© 1998-2014. Ozzu® is a registered trademark of Unmelted, LLC.