...

View Full Version : table column size



mxb7642
08-06-2007, 04:07 PM
I'm trying to make a table with several columns. I would like to force one of the columns to expand completely so that the text it contains does not run over into the second line like this:



| header | header
header 1 | 2 | 3
------------------------------
| |


instead of this:



header | header | header
1 | 2 | 3
--------------------------
| |


Is this possible? thanks for the help.

VIPStephan
08-06-2007, 04:19 PM
<table>
<col id="col1" />
<col id="col2" />
<col id="col3" />
<tr>
<th scope="col">header 1</th>
<th scope="col">header 2</th>
<th scope="col">header 3</th>
</tr>
<tr>
<td>cell 1</td>
<td>cell 2</td>
<td>cell 3</td>
</tr>

</table>




#col1 {width: ??px;}

mxb7642
08-06-2007, 04:32 PM
probably should've mentioned this in my original post: the data in the table varies so the size of column 1 will change which is why using an absolute size will not work for me :(

VIPStephan
08-06-2007, 04:54 PM
Ah then scrap the size thing and prevent the text in the first cell from wrapping instead:


<table>
<tr>
<th id="header1" scope="col">header 1</th>
<th scope="col">header 2</th>
<th scope="col">header 3</th>
</tr>
<tr>
<td>cell 1</td>
<td>cell 2</td>
<td>cell 3</td>
</tr>

</table>



#header1 {white-space: nowrap;}

mxb7642
08-06-2007, 05:20 PM
thank you. exactly what i needed :)



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum