Tables
Tables
Task 1: Border Collapse
- Utilities for controlling whether table borders should collapse or be separated.
border-collapse
border-separate
- Use
border-collapseto combine adjacent cell borders into a single border when possible. - Note that this includes collapsing borders on the top-level
<table>tag.
Example 1:
<table class="border-collapse border border-slate-500 ...">
<thead>
<tr>
<th class="border border-slate-600 ...">State</th>
<th class="border border-slate-600 ...">City</th>
</tr>
</thead>
<tbody>
<tr>
<td class="border border-slate-700 ...">Indiana</td>
<td class="border border-slate-700 ...">Indianapolis</td>
</tr>
<tr>
<td class="border border-slate-700 ...">Ohio</td>
<td class="border border-slate-700 ...">Columbus</td>
</tr>
<tr>
<td class="border border-slate-700 ...">Michigan</td>
<td class="border border-slate-700 ...">Detroit</td>
</tr>
</tbody>
</table>
Task 2: Border Spacing
- Use the
border-spacing-*,border-spacing-x-*, andborder-spacing-y-*utilities to control the space between the borders of table cells with separate borders.
Example 2
<table class="border-separate border-spacing-2 border border-slate-500 ...">
<thead>
<tr>
<th class="border border-slate-600 ...">State</th>
<th class="border border-slate-600 ...">City</th>
</tr>
</thead>
<tbody>
<tr>
<td class="border border-slate-700 ...">Indiana</td>
<td class="border border-slate-700 ...">Indianapolis</td>
</tr>
<tr>
<td class="border border-slate-700 ...">Ohio</td>
<td class="border border-slate-700 ...">Columbus</td>
</tr>
<tr>
<td class="border border-slate-700 ...">Michigan</td>
<td class="border border-slate-700 ...">Detroit</td>
</tr>
</tbody>
</table>
Task 3: Table Layout
Reference