I have a large html table(over 3000 elements), but obviously i dont want to display all of it at once. Some of the table will be displayed but most of it will all be contained in a small box that has scrolling. I wanted a table similar to the one that this site uses:stackoverflow search table.I tried doing something similar my code doesnt work: here is a sample table:
.table {
height: 150px;
overflow-y: scroll;
overflow-x: hidden;
}
<table id="myTable" class="table">
<tr class="header">
<th style="width:60%;">Name</th>
<th style="width:40%;">Country</th>
</tr>
<tr>
<td>Alfreds Futterkiste</td>
<td>Germany</td>
</tr>
<tr>
<td>Berglunds snabbkop</td>
<td>Sweden</td>
</tr>
<tr>
<td>Island Trading</td>
<td>UK</td>
</tr>
<tr>
<td>Koniglich Essen</td>
<td>Germany</td>
</tr>
<tr>
<td>Alfreds Futterkiste</td>
<td>Germany</td>
</tr>
</table>
A scroller never appears at the side of the table. I'm relatively new to HTML