Encodera

Thanks for reading!

Donate to the site — we work hard for you.

HTML & CSS reference

border-collapse

Whether the borders of table cells are separate or merged into single lines.

Syntax

border-collapse: collapse;

Values

ParameterTypeDescription
separatekeywordEach cell has its own border, with gaps between them (the default).
collapsekeywordNeighboring borders merge into one line.

Examples

Double and merged borders:

<style>
  td { border: 1px solid gray; padding: 4px 8px; }
</style>
 
<table><tr><td>separate</td><td>$25</td></tr></table>
<br>
<table style="border-collapse: collapse;"><tr><td>collapse</td><td>$25</td></tr></table>

Notes

collapse is almost always what you want for data tables. With separate, the gap between cells is set by border-spacing.

See also

  • border — A border around the element: width, style and color in one property.
  • <table> — A table made of rows (`<tr>`) and cells.

Related recipes

In the tutorial

  • Styling lists and tables — Marker types and list-style, custom markers with ::marker, a menu from a list without bullets, and table borders, padding, alignment, zebra stripes and the caption.

Thanks for reading!

Donate to the site — we work hard for you.