How to set Table width, height, color & padding using CSS?


This property is used to set whether or not to display borders and background on empty cells in a table. It will work only if the border-collapse is set to separate. We can set this property to show (default) or hide.


table { table-layout: fixed; }

How to set Table width and Height?

We use width and height property to set table width and height.

We can also set table heading (th) width and height.

table { width: 100% ;}

th { height: 10px; }

How to set Table Padding?

This property is used to control the space between the border and the content in a table, this is used on <td> and <th> elements.

th, td { padding: 10px; }

How to set Table color?

table {background-color: pink;}

Tagged : / / / / / / /