Knowledge baseExam Center
ENEnglish
Choose language13

CKTIS / CSS

border-collapse — table border model

The border-collapse property selects how table borders are drawn: separate keeps individual cell edges, while collapse merges adjacent edges into shared borders.

Version: CSS modules; structured CSSWG indexes reconciled with pinned MDN BCD; Chromium 152 scope gate, per-example verification still required

Syntax

border-collapse: separate | collapse;

border-collapse selects a table's border model. Set it on an element with table or inline-table layout, not on an individual cell. Its initial value is separate, and the property is inherited.

With separate, each cell has its own border, and border-spacing controls the gaps between neighboring cell borders. With collapse, adjacent edges form one shared border, and border-spacing is ignored. The property does not create visible lines by itself: specify border as well.

When merging edges have different borders, conflict-resolution rules apply rather than adding their widths. The hidden style suppresses the shared edge; otherwise, wider borders take precedence over narrower ones. Thus, collapse does more than simply remove spacing.

The example compares both models using identical cell borders. In the separate table, the expected gap is 8px; in the collapse table, the expected shared edge is 2px, not 4px.

Examples

<!doctype html>
<meta charset="utf-8">
<title>border-collapse</title>
<style>
  table { border-spacing: 8px; margin-bottom: 16px; }
  .separate { border-collapse: separate; }
  .collapse { border-collapse: collapse; }
  td { border: 2px solid black; padding: 8px; }
</style>
<table class="separate">
  <caption>separate</caption>
  <tr><td>A</td><td>B</td></tr>
</table>
<table class="collapse">
  <caption>collapse</caption>
  <tr><td>A</td><td>B</td></tr>
</table>

Result

separate: A and B have independent borders with an 8px gap.
collapse: A and B share one 2px black border with no gap.

The displayed code and declared result were verified in an isolated environment using the method recorded in the verification evidence for this exact version.

Sources