praetor: Tabelle mit 'fixer' Kopfzeile

Beitrag lesen

Hallo MudGuard!

So sieht der Code dann z.B. aus:
<style type="text/css">
<!--
/*  ... Style-Sheet-Angaben ... */
table { height:100px; width:800px; border-collapse:collapse; border-spacing:0; }
tbody { height:80px; overflow:auto; }
tr { height:2em; }
th { text-align:left; }
td { border-style:solid; border-color:black; border-width:1px;  }
-->
</style>

</head>
<body>
<table>
<thead>
<tr><th>col 1</th><th>col 2</th><th>col 3</th><th>col 4</th><th>col 5</th></tr>
</thead>
<tbody>
<tr><td>col 1 row 01</td><td>col 2 row 01</td><td>col 3 row 01</td><td>col 4 row 01</td><td>col 5 row 01</td></tr>
<tr><td>col 1 row 02</td><td>col 2 row 02</td><td>col 3 row 02</td><td>col 4 row 02</td><td>col 5 row 02</td></tr>
<!-- hier noch zig mehr Zeilen -->
</tbody>
</table>

Ja, das funktioniert wirklich. Ich bin beeindruckt. Zwar muß man für diese Lösung die m.E. HTML-averse "Kröte" einer starr definierten Tabellenhöhe schlucken, aber es ist da wohl wie im richtigen Leben. Man kann nicht alles haben.

Herzlichen Dank für Deinen wertvollen Hinweis.

praetor