Table with fixed header
by вaкa тєиѕai
HTML
<div style="overflow: scroll; width: 600px;height:300px;">
<table class="myTable tablesorter" style="width:100%;" id="table">
<thead style=" font-size: 13px;height: 70px; position:fixed;">
<tr>
<th style="width:25px;cursor:pointer;" class="header">Title1</th>
<th style="width:118px;cursor:pointer;" class="header">Title2</th>
<th style="width:100px;cursor:pointer;" class="header">Title3</th>
<th style="width:200px;cursor:pointer;" class="header"><span style='text-ident:-99999;opacity:0;
filter:alpha(opacity=0); /* For IE8 and earlier */'>......................</span>Title4</th>
<th style="width:87px;cursor:pointer;" class="header">Title5</th>
</tr>
</thead>
<tbody style="font-size: 0.7em; ">
<tr bgcolor="#FFFFFF">
<td>Test data</td>
<td>Test data</td>
<td style="white-space:nowrap;">Test data This has long text</td>
<td style="white-space:nowrap;">Test data</td>
<td style="white-space:nowrap;">Test data</td>
</tr>
<tr bgcolor="#FFFFFF">
<td>Test data</td>
<td>Test data</td>
<td style="white-space:nowrap;">Test data This has long text</td>
<td style="white-space:nowrap;">Test data</td>
<td style="white-space:nowrap;">Test data</td>
</tr>
<tr bgcolor="#FFFFFF">
<td>Test data</td>
<td>Test data</td>
<td style="white-space:nowrap;">Test data This has long text</td>
<td style="white-space:nowrap;">Test data</td>
<td style="white-space:nowrap;">Test data</td>
</tr>
<tr bgcolor="#FFFFFF">
<td>Test data</td>
<td>Test data</td>
<td style="white-space:nowrap;">Test data This has...
CSS
table#table {
border-collapse: collapse;
border-spacing: 0;
font-family:'PT sans', Arial, Sans-serif;
width:100%;
}
table#table th {
background-color:#066D99;
color:#fff;
padding: 0 5px;
font-weight: bold;
font-size: 0.87em;
height: 20px;
}
table#table td {
height: 36px;
padding: 0 4px;
text-align: left;
vertical-align: middle;
padding-top:10px;
}
body {
font-family:'PT Sans', Arial, sans-serif;
font-size: 11px;
color: #666666;
}
th.headerSortUp, th.headerSortDown {
border-color:#044059;
background-color:#044059 !important;
}