To create a more modern and visually appealing table with Tailwind CSS, you can use the divide-{width} utilities to control the border width between elements and the divide-{style} utilities to control the border style between elements. Here's an example of how to create a table with borders using Tailwind CSS:
<table class="w-full">
<thead class="bg-gray-50">
<tr class="text-left">
<th class="px-4 py-2 text-xs font-medium text-gray-500 uppercase tracking-wider">Column 1</th>
<th class="px-4 py-2 text-xs font-medium text-gray-500 uppercase tracking-wider">Column 2</th>
<th class="px-4 py-2 text-xs font-medium text-gray-500 uppercase tracking-wider">Column 3</th>
</tr>
</thead>
<tbody class="bg-white divide-y divide-gray-200">
<tr>
<td class="px-4 py-2">Row 1, Column 1</td>
<td class="px-4 py-2">Row 1, Column 2</td>
<td class="px-4 py-2">Row 1, Column 3</td>
</tr>
<tr>
<td class="px-4 py-2">Row 2, Column 1</td>
<td class="px-4 py-2">Row 2, Column 2</td>
<td class="px-4 py-2">Row 2, Column 3</td>
</tr>
<!-- Add more rows as needed -->
</tbody>
</table>
In this example, the divide-y class is used to create vertical borders between the rows, and the divide-gray-200 class is used to set the border color to a light gray. You can customize the border width and style using the divide-{width} and divide-{style} utilities, respectively.
For a more responsive table, you can use the divider-{responsive} modifiers to adjust the border width based on the screen size. For example:
<table class="w-full">
<thead class="bg-gray-50">
<tr class="text-left">
<th class="px-4 py-2 text-xs font-medium text-gray-500 uppercase tracking-wider">Column 1</th>
<th class="px-4 py-2 text-xs font-medium text-gray-500 uppercase tracking-wider">Column 2</th>
<th class="px-4 py-2 text-xs font-medium text-gray-500 uppercase tracking-wider">Column 3</th>
</tr>
</thead>
<tbody class="bg-white divide-y divide-gray-200 sm:divide-y-0">
<tr>
<td class="px-4 py-2">Row 1, Column 1</td>
<td class="px-4 py-2">Row 1, Column 2</td>
<td class="px-4 py-2">Row 1, Column 3</td>
</tr>
<tr>
<td class="px-4 py-2">Row 2, Column 1</td>
<td class="px-4 py-2">Row 2, Column 2</td>
<td class="px-4 py-2">Row 2, Column 3</td>
</tr>
<!-- Add more rows as needed -->
</tbody>
</table>
In this example, the sm:divide-y-0 class is used to remove the vertical borders for screen sizes larger than medium. You can replace sm with other responsive breakpoints like md, lg, and xl to adjust the responsive behavior of the table.