I'm trying to implement my table with a scroll bar that will only how about 10 teams until it forces you to scroll down. However, I can't seem to get the coding right.
I'm planning on implementing the scrollable table across several different pages, in which the column headers will change in width. All the examples I have found required a fixed width for each column, is there a better way to do this?
** I want to keep fixed headers **
Here is my PHP code:
echo '<table align="center" cellspacing="3" cellpadding="3" width="80%" border="1">
<tr>
<th align="center">Team Name</th>
<th align="center">Wins</th>
<th align="center">Losses</th>
<th align="center">Winning %</th>
</tr><div id="scrll_tbl">';
$bg = '#eeeeee';
for($i = 0; $i < count($teams); $i++) {
$bg = ($bg == '#eeeeee' ? '#fffffff' : '#eeeeee');
$wnpctg = $teams[$i][1] / ($teams[$i][1] + $teams[$i][2]);
echo '<tr bgcolor="' .$bg. '">
<td align="center">' . $teams[$i][0] . '</td>
<td align="center">' . $teams[$i][1] . '</td>
<td align="center">' . $teams[$i][2] . '</td>
<td align="center">' . number_format($wnpctg,3) . '</td>
</tr>';
}
echo '</div></table>';
and here is my CSS:
#scrll_tbl {
overflow: scroll;
height: 100px;
}