I would like to have a table on my website. The problem is that this table will have about 400 lines. How can I limit the table’s height, and apply scrollbar to it?
This is my code:
<div class="span3">
<h2>Achievements left</h2>
<table class="table table-striped">
<thead>
<tr>
<th>#</th>
<th>Name</th>
</tr>
</thead>
<tbody>
<tr>
<td>1</td>
<td>Something</td>
</tr>
<tr>
<td>2</td>
<td>Something</td>
</tr>
<tr>
<td>3</td>
<td>Something</td>
</tr>
<tr>
<td>4</td>
<td>Something</td>
</tr>
<tr>
<td>5</td>
<td>Something</td>
</tr>
<tr>
<td>6</td>
<td>Something</td>
</tr>
</tbody>
</table>
<p><a class="btn" href="#">View details »</a></p>
</div>
I tried to apply max-height and fixed height to table, but it doesn’t work.
Table elements don’t appear to support this directly. Place the table in a div and set the height of the div and set
overflow: auto.