---
id: css-table-alignment
title: "CSS Table Alignment"
category: "Frontend"
status: "draft"
verification_status: "conceptual"
canonical_id: ""
aliases: ["table text-align", "table vertical-align", "table alignment", "th td alignment", "center table cell"]
duplicate_of: ""
source_trust_level: "B"
confidence_score: 0.88
created_at: 2026-06-23
updated_at: 2026-06-23
review_reason: ""
merge_history: []
tags: ["css", "web", "frontend", "w3schools", "table", "text-align", "vertical-align"]
raw_sources: ["https://www.w3schools.com/css/css_table_align.asp"]
applied_in: []
github_commit: ""
---
# [[CSS Table Alignment]]
## π― ν μ€ ν΅μ°° (One-line insight)
`text-align` controls horizontal alignment and `vertical-align` controls vertical alignment of content inside `
` and ` | ` cells. [S1]
## π§ ν΅μ¬ κ°λ
(Core concepts)
- **`text-align` = horizontal** β the CSS `text-align` property is used to set the horizontal alignment of the content in ` | ` or ` | `. [S1]
- **`vertical-align` = vertical** β the CSS `vertical-align` property sets the vertical alignment (like top, bottom, or middle) of the content in ` | ` or ` | `. [S1]
- **Defaults for headers vs data** β by default, the content of ` | ` elements is center-aligned and the content of ` | ` elements is left-aligned. [S1]
- **Default vertical alignment** β by default, the vertical alignment of the content in a table is middle (for both ` | ` and ` | ` elements). [S1]
## π§© μΆμΆλ ν¨ν΄ (Extracted patterns)
- **Horizontal values** β `text-align` accepts `left` (aligns text to the left), `right` (aligns text to the right), and `center` (centers the text). [S1]
- **Vertical sizing pairing** β to make a vertical alignment visible, give the cell a `height` and then set `vertical-align` (e.g. `bottom`). [S1]
## π μΈλΆ λ΄μ© (Details)
**Horizontal Alignment**
The CSS `text-align` property is used to set the horizontal alignment of the content in ` | ` or ` | `. Property values: [S1]
- `left` β aligns the text to the left
- `right` β aligns the text to the right
- `center` β centers the text
**Note:** By default, the content of ` | ` elements is center-aligned and the content of ` | ` elements is left-aligned. [S1]
Center the content of ` | ` elements: [S1]
```css
td {
text-align: center;
}
```
Left-align the content of ` | ` elements: [S1]
```css
th {
text-align: left;
}
```
**Vertical Alignment**
The CSS `vertical-align` property sets the vertical alignment (like top, bottom, or middle) of the content in ` | ` or ` | `. [S1]
**Note:** By default, the vertical alignment of the content in a table is middle (for both ` | ` and ` | ` elements). [S1]
The example below sets the vertical text alignment to bottom for ` | ` elements: [S1]
```css
td {
height: 50px;
vertical-align: bottom;
}
```
The source illustrates these rules with sample data tables containing Firstname/Lastname/Savings columns (e.g. Peter Griffin / $100, Lois Griffin / $150, Joe Swanson / $300). [S1]
## π οΈ μ μ© μ¬λ‘ (Applied in summary)
The page's own examples are the applied cases: centering ` | ` content, left-aligning ` | ` content, and bottom vertical alignment of ` | ` with a 50px height. No external project/commit applications found in the source.
## π» μ½λ ν¨ν΄ (Code patterns)
Horizontal alignment (language: CSS):
```css
td {
text-align: center;
}
```
Vertical alignment (language: CSS):
```css
td {
height: 50px;
vertical-align: bottom;
}
```
## βοΈ λͺ¨μ λ° μ
λ°μ΄νΈ (Contradictions & updates)
No contradictions found in the source.
## β
κ²μ¦ μν λ° μ λ’°λ
- **μν:** draft
- **κ²μ¦ λ¨κ³:** conceptual (μ€μ μ μ© μ¬λ‘ λ°κ²¬ μ applied/validatedλ‘ μΉκ²© κ°λ₯)
- **μΆμ² μ λ’°λ:** B (W3Schools β widely used educational reference, not a primary standards body)
- **μ λ’° μ μ:** 0.88
- **μ€λ³΅ κ²μ¬ κ²°κ³Ό:** μ κ· μμ± (New discovery)
## π μ§μ κ·Έλν (Knowledge Graph)
- **μμ/루νΈ:** [[CSS Tutorial]]
- **κ΄λ ¨ κ°λ
:** [[CSS Table Size]], [[CSS Table Styling]], [[CSS Table Responsive]]
- **μ°Έμ‘° λ§₯λ½:** Referenced whenever aligning header or data content inside an HTML table.
## π μΆμ² (Sources)
- [S1] W3Schools β CSS Table Alignment β https://www.w3schools.com/css/css_table_align.asp
## π λ³κ²½ μ΄λ ₯ (Change history)
- 2026-06-23: Initial draft synthesized from the W3Schools "CSS Table Alignment" page (Astra wiki-curation, P-Reinforce v3.1 format).
|