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