bugl
bugl
HomeLearnPatternsSearch
HomeLearnPatternsSearch

Loading lesson path

Learn/CSS/CSS Foundations
CSS•CSS Foundations

CSS Table Size (Width and Height)

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 auto keyword

CSS Table Width in Percent

Formula

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

Full-width table:

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

Previous

CSS Tables

Next

CSS Table Alignment