---
id: css-table-style
title: "CSS Table Style"
category: "Frontend"
status: "draft"
verification_status: "conceptual"
canonical_id: ""
aliases: ["table padding", "zebra-striped table", "hoverable table", "table borders", "nth-child table"]
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", "table", "styling", "nth-child", "hover"]
raw_sources: ["https://www.w3schools.com/css/css_table_style.asp"]
applied_in: []
github_commit: ""
---
# [[CSS Table Styling]]
## π― ν μ€ ν΅μ°° (One-line insight)
Tables become readable and attractive by adding cell padding, horizontal dividers, hover highlighting, zebra striping, and header colors. [S1]
## π§ ν΅μ¬ κ°λ
(Core concepts)
- **Padding adds breathing room** β to add more space between the inner borders and the content in a table, use the `padding` property on `
` and ` | ` elements. [S1]
- **Horizontal dividers** β to create horizontal dividers for a table, add the `border-bottom` property to ` | ` and ` | ` elements. [S1]
- **Hover highlighting** β use the CSS `:hover` selector on ` | ` to highlight table rows on mouse over. [S1]
- **Zebra striping** β for zebra-striped tables, use the `nth-child()` selector and add a `background-color` to all even (or odd) table rows. [S1]
- **Header coloring** β specify a `background-color` and a text `color` for the `| ` elements. [S1]
## π§© μΆμΆλ ν¨ν΄ (Extracted patterns)
- **Group selector for cells** β style `th, td` together to apply padding/borders uniformly across header and data cells. [S1]
- **Row-level pseudo-classes** β `tr:hover` and `tr:nth-child(even)` target whole rows for interactivity and striping. [S1]
## π μΈλΆ λ΄μ© (Details)
**CSS Table Padding**
To add some more space between the inner borders and the content in a table, use the `padding` property on ` | ` and ` | ` elements: [S1]
```css
th, td {
padding: 10px;
text-align: left;
}
```
**CSS Horizontal Dividers**
To create horizontal dividers for a table, add the `border-bottom` property to ` | ` and ` | ` elements: [S1]
```css
th, td {
border-bottom: 1px solid #ddd;
}
```
**CSS Hoverable Table**
Use the CSS `:hover` selector on ` |
` to highlight table rows on mouse over: [S1]
```css
tr:hover {background-color: coral;}
```
**CSS Zebra-striped Table**
For zebra-striped tables, use the `nth-child()` selector and add a `background-color` to all even (or odd) table rows: [S1]
```css
tr:nth-child(even) {background-color: #f2f2f2;}
```
**CSS Table Color**
The example below specifies a background color and a text color for the `| ` elements: [S1]
```css
th {
background-color: #04AA6D;
color: white;
}
```
## π οΈ μ μ© μ¬λ‘ (Applied in summary)
The page's own examples are the applied cases: 10px cell padding, 1px horizontal dividers, coral hover rows, `#f2f2f2` zebra striping on even rows, and a green (`#04AA6D`) header with white text. No external project/commit applications found in the source.
## π» μ½λ ν¨ν΄ (Code patterns)
Zebra striping (language: CSS):
```css
tr:nth-child(even) {background-color: #f2f2f2;}
```
Hover highlight (language: CSS):
```css
tr:hover {background-color: coral;}
```
## βοΈ λͺ¨μ λ° μ
λ°μ΄νΈ (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 Table Size]], [[CSS Table Alignment]], [[CSS Table Responsive]]
- **μ°Έμ‘° λ§₯λ½:** Referenced whenever visually styling an HTML table beyond plain borders.
## π μΆμ² (Sources)
- [S1] W3Schools β CSS Table Style β https://www.w3schools.com/css/css_table_style.asp
## π λ³κ²½ μ΄λ ₯ (Change history)
- 2026-06-23: Initial draft synthesized from the W3Schools "CSS Table Style" page (Astra wiki-curation, P-Reinforce v3.1 format).
|