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)
- by the
autokeyword
CSS Table Width in Percent
To create a table that spans the entire screen (full-width), use width: 100%;:
| Firstname | Lastname | Savings |
|---|---|---|
| Peter | Griffin | $100 |
| Lois | Griffin | $150 |
| Joe | Swanson | $300 |
Example
table
{
width: 100%;
}
To create a table that spans half the page, use width: 50%;:
| Firstname | Lastname | Savings |
|---|---|---|
| Peter | Griffin | $100 |
| Lois | Griffin | $150 |
| Joe | Swanson | $300 |
Example
table
{
width: 50%;
}
CSS Table Width in a Fixed Width
To create a table with a fixed width, use width: 500px:
| Firstname | Lastname | Savings |
|---|---|---|
| Peter | Griffin | $100 |
| Lois | Griffin | $150 |
| Joe | Swanson | $300 |
Example
table
{
width: 500px;
}
CSS Table Width Using auto
To let the browser calculate the width, use width: auto;:
| Firstname | Lastname | Savings |
|---|---|---|
| Peter | Griffin | $100 |
| Lois | Griffin | $150 |
| Joe | Swanson | $300 |
Example
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)
- by the
autokeyword
The example below sets the height of the table headers (
| Firstname | Lastname | Savings |
|---|---|---|
| Peter | Griffin | $100 |
| Lois | Griffin | $150 |
| Joe | Swanson | $300 |
Example
th
{
height: 70px;
}
Want to go beyond the notes?
Join CodingNow 2.0's CSS course — live mentorship, real projects, and 100% placement support.
Enroll Now — Free Demo AvailableTable Size – FAQs
Quick answers about learning Table Size in CSS.
This free note from CodingNow 2.0 explains Table Size in CSS — concept, syntax and worked code examples you can copy, run and revise before interviews.
Yes. Every CSS topic on CodingNow 2.0, including Table Size, is 100% free with no signup required.
With focused practice, most students grasp Table Size in 1–3 days from these notes; pairing it with CodingNow 2.0's mentor-led course takes you to job-ready depth faster.
Use the code examples in this note, then ask doubts for free on the CodingNow 2.0 Community (/community) — expert instructors answer within 24 hours.