Last updated: 1 May 2024

Tailwind Border Collapse

The tailwind border collapse utility class in Tailwind CSS allows you to control the collapsing behavior of borders in a table.


Tailwind Border Collapse

The tailwind border collapse utility class in Tailwind CSS allows you to control the collapsing behavior of borders in a table. With Tailwind's border collapse class, you can easily adjust whether the borders should collapse or separate between table cells.

Applying Tailwind Border Collapse

To apply the tailwind border collapse behavior to a table, you can use the border-collapse-{value} utility class, where {value} represents the desired behavior. Here are the available options:

  • border-collapse: Borders collapse between table cells (default).
  • border-separate: Borders are separate between table cells.
html
<table class="border-collapse">
<!-- Table content here -->
</table>

Preview

Country

Capital

USA

Washington, D.C.

AustraliaCanberra
ChinaBeijing

If you want to keep the borders separate between table cells, you can use the border-separate class:

html
<table class="border-separate">
<!-- Table content here -->
</table>

Preview

Country

Capital

USA

Washington, D.C.

AustraliaCanberra
ChinaBeijing

Responsive Tailwind Border Collapse

Tailwind CSS allows you to apply the border collapse class responsively at different breakpoints. To use responsive tailwind border collapse classes, you can append the breakpoint prefix to the utility class. For example, md:border-separate applies the separate border collapse behavior starting from the medium breakpoint and above.

html
<table class="border-collapse md:border-separate">
<!-- Table content here -->
</table>

In the above example, the table has the default border collapse behavior by default (border-collapse), but starting from the medium breakpoint and above, the separate border collapse behavior is applied (md:border-separate).

Tailwind Border Collapse Class Table

ClassProperties
border-collapseborder-collapse: collapse;
border-separateborder-collapse: separate;

Windframe Tailwind blocks

Content

Windframe is a drag and drop builder for rapidly building tailwind css websites and UIs

Start building stunning tailwind UIs! 

Build from scratch or select prebuilt tailwind templates