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.
<table class="border-collapse"> <!-- Table content here --></table>
Preview
Country | Capital |
---|---|
USA | Washington, D.C. |
Australia | Canberra |
China | Beijing |
If you want to keep the borders separate between table cells, you can use the border-separate
class:
<table class="border-separate"> <!-- Table content here --></table>
Preview
Country | Capital |
---|---|
USA | Washington, D.C. |
Australia | Canberra |
China | Beijing |
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.
<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
Class | Properties |
---|---|
border-collapse | border-collapse: collapse; |
border-separate | border-collapse: separate; |
Windframe Tailwind blocks
Windframe is a drag and drop builder for rapidly building tailwind css websites and UIs