HOME C C++ PYTHON JAVA HTML CSS JAVASCRIPT BOOTSTRAP JQUERY REACT PHP SQL AJAX JSON DATA SCIENCE AI

CSS Table Size

The term "CSS Table Size" could refer to different aspects of styling and sizing tables using Cascading Style Sheets (CSS). Let's explore a few possibilities:

Table Width and Height

The width and height of a table are defined by the width and height properties.

The example below sets the width of the table to 100%, and the height of the <th> elements to 70px:

Example

table {
  width:  100%;
}

th {
  height:  70px;
}
You can click on above box to edit the code and run again.

Output

Firstname Lastname Savings
Peter Griffin $100
Lois Griffin $150
Joe Swanson $300
Cleveland Brown $250

To create a table that should only span half the page, use width: 50%:

Example

table {
  width: 50%;
}

You can click on above box to edit the code and run again.

Output

Firstname Lastname Savings
Peter Griffin $100
Lois Griffin $150
Joe Swanson $300
Cleveland Brown $250