HTML simple table with fixed header

October 23, 2019 8:53 pm Published by

Alcuni esempi per realizzare una tabella HTML con intestazione fissa.

<table width="100%" height="100%" 
       style="border:solid; border-width:1px">
    <tr>
        <td style="border:solid; border-width:1px; height:65px">
           <strong>Header</strong>
        </td>
    </tr>
    <tr>
        <td style="border:solid; border-width:1px">
            Test1
        </td>
    </tr>
</table>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" 
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html>
<head>
<style type="text/css">
body{ 
     width: 100%; 
     height:100%; 
 } 
 table{ 
     width:100%; 
     height:100%; 
     top:0; 
     left:0; 
     right:0; 
     bottom:0; 
     position: absolute; 
     border:solid; 
	 border-width:1px;
 } 
 tr{ 
     height:auto; 
     //background-color:blue; 
 } 
 td {
     border:solid; 
	 border-width:1px;
 }
</style>
</head>
<body>
<table>
<tr style="height:65px">
  <td>1a</td><td>1b</td>
</tr>
<tr>
  <td>2a</td><td>2b</td>
</tr>
</table>
<body>
</html>

Categorised in:

This post was written by admin

Comments are closed here.