Table Width  50 pixels vs. 50%

You can specify table width as pixels or percentage, but you should stick with one or the other since using both  percentages and pixels within the same table may produce unpredictable results.

Width of table specified as 50, interpreted as 50 pixels, not very wide.

cell 1 cell 2
cell 3 cell 4
cell 4 This is a very large cell 6

Produced by HTML Code:

<table border="1" width="50">

<tr>
       
<td >cell 1</td>
        <td >cell 2</td>
</tr>

<tr>
    <td
>cell 3</td>
    <td
>cell 4</td>
</tr>

<tr>
    <td>cell 4</td>
    <td>This is a very large cell 6</td>
</tr>

</table>

Using 50% table is displayed within 50% of area, in this case approximately 50% of the white part of this screen.  Note how column widths flow to fit data in cells.

cell 1 cell 2
cell 3 cell 4
cell 4 This is a very large cell 6

Produced by HTML Code:

<table border="1" width="50%">

<tr>
       
<td >cell 1</td>
        <td >cell 2</td>
</tr>

<tr>
    <td
>cell 3</td>
    <td
>cell 4</td>
</tr>

<tr>
    <td>cell 4</td>
    <td>This is a very large cell 6</td>
</tr>

</table>

 

     

Last updated on 03/05/2007 by L.M. Hicks