---
id: css-table-borders
title: "CSS Table Borders"
category: "Frontend"
status: "draft"
verification_status: "conceptual"
canonical_id: ""
aliases: ["table borders", "border-collapse", "border-spacing", "CSS tables", "table styling", "collapse borders"]
duplicate_of: ""
source_trust_level: "B"
confidence_score: 0.89
created_at: 2026-06-23
updated_at: 2026-06-23
review_reason: ""
merge_history: []
tags: ["css", "web", "frontend", "w3schools", "tables", "borders"]
raw_sources: ["https://www.w3schools.com/css/css_table.asp"]
applied_in: []
github_commit: ""
---
# [[CSS Table Borders]]
## π― ν μ€ ν΅μ°° (One-line insight)
Adding borders to `table`, `th`, and `td` separately produces double borders by default; `border-collapse: collapse` merges them into a single border, while `border-spacing` (only with `separate`) controls the gap between separated cell borders. [S1]
## π§ ν΅μ¬ κ°λ
(Core concepts)
- **Border shorthand** β the CSS `border` property is a shorthand property for `border-width`, `border-style`, and `border-color`. [S1]
- **Double borders by default** β because the `
`, `| `, and ` | ` elements have separate borders, applying borders to all of them yields double borders. [S1]
- **Collapsing** β the `border-collapse` property sets whether table borders should collapse into a single border or be separated as in standard HTML. [S1]
## π§© μΆμΆλ ν¨ν΄ (Extracted patterns)
- **Single-border table** β apply `border-collapse: collapse` to the table to merge adjacent cell borders. [S1]
- **Spaced cells** β set `border-collapse: separate` and use `border-spacing` to control distance between cell borders. [S1]
- **Outer border only** β apply the `border` property only to the `` element (not to `th`/`td`) to draw a border around just the table. [S1]
## π μΈλΆ λ΄μ© (Details)
**Table Borders** β to add borders to a table, use the CSS `border` property. The CSS `border` property is a shorthand property for `border-width`, `border-style`, and `border-color`. The example below specifies a black border for ``, `| `, and ` | ` elements: [S1]
```css
table, th, td {
border: 1px solid;
}
```
A border color can be added in the same shorthand: [S1]
```css
table, th, td {
border: 1px solid green;
}
```
**Collapse Table Borders** β the tables above have double borders. This is because both the ``, `| `, and ` | ` elements have separate borders. To remove double borders, use the `border-collapse` property: [S1]
```css
table {
border-collapse: collapse;
}
```
The `border-collapse` property can have one of the following values: [S1]
| Value | Description |
|-------|-------------|
| `separate` | Default value. Borders are separated; each cell will display its own borders |
| `collapse` | Borders are collapsed into a single border when possible |
**Border Spacing** β the `border-spacing` property sets the distance between the borders of adjacent cells. This property works only when `border-collapse` is set to `separate`: [S1]
```css
table {
border-collapse: separate;
border-spacing: 15px;
}
```
**Borders Around the Table Only** β if you only want a border around the table, the `border` property should only be specified for the `` element: [S1]
```css
table {
border: 1px solid;
}
```
Dotted/styled or rounded border examples: "Not found in source" within the borders portion of this page. [S1]
## π οΈ μ μ© μ¬λ‘ (Applied in summary)
The page's own examples apply borders to `table`/`th`/`td`, collapse them with `border-collapse: collapse`, add spacing with `border-spacing`, and draw a border around the table only. No external project/commit applications found in the source.
## π» μ½λ ν¨ν΄ (Code patterns)
Single (collapsed) border table (language: CSS):
```css
table, th, td {
border: 1px solid;
}
table {
border-collapse: collapse;
}
```
Spaced separate borders:
```css
table {
border-collapse: separate;
border-spacing: 15px;
}
```
## βοΈ λΉκ΅ λ° μ ν κΈ°μ€ (Comparison & decision criteria)
The page contrasts the two `border-collapse` values. **`separate`** (the default) keeps each cell's borders independent and is the only mode in which `border-spacing` has any effect β choose it when you want visible gaps between cells. **`collapse`** merges adjacent borders into a single line β choose it to eliminate the default double-border appearance. The decision is whether spaced, individually-bordered cells or a single clean grid line is desired. [S1]
## βοΈ λͺ¨μ λ° μ
λ°μ΄νΈ (Contradictions & updates)
No contradictions found in the source.
## β
κ²μ¦ μν λ° μ λ’°λ
- **μν:** draft
- **κ²μ¦ λ¨κ³:** conceptual (μ€μ μ μ© μ¬λ‘ λ°κ²¬ μ applied/validatedλ‘ μΉκ²© κ°λ₯)
- **μΆμ² μ λ’°λ:** B (W3Schools β widely used educational reference, not a primary standards body)
- **μ λ’° μ μ:** 0.89
- **μ€λ³΅ κ²μ¬ κ²°κ³Ό:** μ κ· μμ± (New discovery)
## π μ§μ κ·Έλν (Knowledge Graph)
- **μμ/루νΈ:** [[CSS Tutorial]]
- **κ΄λ ¨ κ°λ
:** [[CSS Styling Lists]], [[CSS Styling Links]], [[CSS Font Shorthand]]
- **μ°Έμ‘° λ§₯λ½:** Referenced when applying and collapsing borders on HTML tables.
## π μΆμ² (Sources)
- [S1] W3Schools β CSS Table Borders β https://www.w3schools.com/css/css_table.asp
## π λ³κ²½ μ΄λ ₯ (Change history)
- 2026-06-23: Initial draft synthesized from the W3Schools "CSS Table Borders" page (Astra wiki-curation, P-Reinforce v3.1 format).
| | |