The syntax for specifying the table width is:
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:
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:
Layout | HTML tags | ||||||
---|---|---|---|---|---|---|---|
|
<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> |