The width and height of a table can be specified using the width and height properties.
In the example below, the width of the table is set to 100%, and the height of the <th> elements is defined as 70px:
Firstname | Lastname | Savings |
---|---|---|
Peter | Griffin | $100 |
Lois | Griffin | $150 |
Joe | Swanson | $300 |
Example
table { width: 100%; } th { height: 70px; } |
To generate a table that occupies only half of the page, employ width: 50%.
Firstname | Lastname | Savings |
---|---|---|
Peter | Griffin | $100 |
Lois | Griffin | $150 |
Joe | Swanson | $300 |
Example
table { width: 50%; } |