--- 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).