I have a problem with printing a HTML table and I didn't find any solutions so I hope you can help me.
I need create table (probably with CSS) with these two rules:
When HTML table exceeds to the next A4 page I need repeat the HTML header on top of the new page;
I need to define some section in the table - this section has to be on the same page - it can not be split on more pages... In the table will be more sections and every section has to be whole on one Page (one A4 page can hold more sections, but one section can not be split to more A4 pages).
Can you help me?
EDIT: it is working now, but I would like to apply the margin to the thead on the top of every page, but it is not working.
<html>
<head>
<title>pokus</title>
<meta charset='UTF-8' />
<style type='text/css'>
@media print
{
tbody {
page-break-inside: avoid;
}
thead {
display: table-header-group;
margin-top: 100px;
}
}
</style>
</head>
<body>
<table>
<thead>
<tr>
<td>Column 1</td>
<td>Column 2</td>
<td>Column 3</td>
</tr>
</thead>
<tbody>
<tr><td>Blok1</td><td>Blok1</td><td>Blok1</td></tr>
<tr><td>Blok1</td><td>Blok1</td><td>Blok1</td></tr>
<tr><td>Blok1</td><td>Blok1</td><td>Blok1</td></tr>
<tr><td>Blok1</td><td>Blok1</td><td>Blok1</td></tr>
.... more rows ...
<tr><td>Blok1</td><td>Blok1</td><td>Blok1</td></tr>
<tr><td>Blok1</td><td>Blok1</td><td>Blok1</td></tr>
</tbody>
<tbody>
<tr><td>Blok2</td><td>Blok2</td><td>Blok2</td></tr>
<tr><td>Blok2</td><td>Blok2</td><td>Blok2</td></tr>
.... more rows ....
<tr><td>Blok2222222</td><td>Blok2</td><td>Blok2</td></tr>
</tbody>
<tbody>
<tr><td>Blok3</td><td>Blok3</td><td>Blok3</td></tr>
....more rows
<tr><td>Blok3</td><td>Blok3</td><td>Blok3</td></tr>
</tbody>
</table>
</body>
</html>