--- id: css-table-size title: "CSS Table Size" category: "Frontend" status: "draft" verification_status: "conceptual" canonical_id: "" aliases: ["table width", "table height", "CSS table sizing", "full-width table", "table width 100%"] 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", "width", "height"] raw_sources: ["https://www.w3schools.com/css/css_table_size.asp"] applied_in: [] github_commit: "" --- # [[CSS Table Size]] ## π― ν μ€ ν΅μ°° (One-line insight) The `width` and `height` properties control the size of a table and its cells, accepting percentage, fixed-pixel, or `auto` values. [S1] ## π§ ν΅μ¬ κ°λ (Core concepts) - **`width` sets table width** β the CSS `width` property is used to set the width of a table. [S1] - **Three width units** β width can be set in percent (%), as a fixed length (px), or by the `auto` keyword. [S1] - **`height` sets table height** β the CSS `height` property is used to set the height of a table; it can likewise be set in percent (%), as a fixed length (px), or by `auto`. [S1] - **Auto = browser calculates** β using `width: auto;` lets the browser calculate the width. [S1] ## π§© μΆμΆλ ν¨ν΄ (Extracted patterns) - **Full-width pattern** β `width: 100%;` makes a table span the entire screen. [S1] - **Fractional-width pattern** β `width: 50%;` makes a table span half the page. [S1] - **Cell sizing** β apply `height` to `th` (or `td`) to size individual cells, e.g. set header height. [S1] ## π μΈλΆ λ΄μ© (Details) **CSS Table Width** The CSS `width` property is used to set the width of a table. The width can be set: in percent (%), as a fixed length (px), or by the `auto` keyword. [S1] To create a table that spans the entire screen (full-width), use `width: 100%;`: [S1] ```css table { width: 100%; } ``` To create a table that spans half the page, use `width: 50%;`: [S1] ```css table { width: 50%; } ``` To create a table with a fixed width, use `width: 500px`: [S1] ```css table { width: 500px; } ``` To let the browser calculate the width, use `width: auto;`: [S1] ```css table { width: auto; } ``` **CSS Table Height** The CSS `height` property is used to set the height of a table. The height can be set: in percent (%), as a fixed length (px), or by the `auto` keyword. The example below sets the height of the table headers (`