How do you make a small/compact table using Bootstrap?
Experience Level: Junior
Tags: Bootstrap 4
Answer
In order to create a small/compact table, use standard html tags <table>
, <tr>
, <th>
and <td>
. Then add a class table table-sm
to the <table>
tag.
<table class="table table-sm">
<tr>
<th>ID</th>
<th>Name</th>
</tr>
<tr>
<td>11</td>
<td>Peter</td>
</tr>
<tr>
<td>12</td>
<td>Jane</td>
</tr>
</table>
Related Bootstrap job interview questions
Using Bootstrap, how do you make a table responsive so that it is accessible on mobile devices?
Bootstrap 4 JuniorUsing Bootstrap, how do you color individual table rows or cells?
Bootstrap 4 JuniorUsing Bootstrap, how do you make a table that highlights a row when you move a mouse cursor over it?
Bootstrap 4 JuniorHow do you make a bordered table using Bootstrap?
Bootstrap 4 JuniorHow do you add zebra-striping and dark style to a table using Bootstrap?
Bootstrap 4 Junior