Working with table and cell size

Defining the table and cell size

The syntax for specifying the table width is:

<table width="value">

where the value is the size of the table measured in pixels or as a percentage of the display area.

Similarly, the width of each cell can be specified within the <th> of <td> tags:

<td width="value">

The following table occupies 75% of the displayed area, has height of 150 pixels, and the width of its first column is 30% of the table width:

LayoutHTML tags
Col 1 Col 2
cell 1 cell 2
cell 3 cell 4
<table border="1" width="75%">
<tr><th width="30%">Col 1</th> <th>Col 2</th></tr>
<tr><td>cell 1</td> <td>cell 2</td></tr>
<tr><td>cell 3</td> <td>cell 4</td></tr> </table>