PDA

View Full Version : Determining Table Column width?



tracy78
05-17-2006, 02:43 PM
I have a little bit of an issue. I was trying to make a scrollable table that worked in IE and Firefox but no matter how many examples from the web I tried it just wasn't working in my application. So I went to another plan. The titles of the columns will be in a separate table than the data.

<table>
<tr><td>Column 1</td></tr>
...

</table>

<table>
<tr></td>data</td></tr>
...
</table>

The data is populated into the tables from a database. The widths of the columns are not set initially - so the table gets filled with data and the widths are natural based on the data.

My problem is that I need the columns of the table containing the column headers to be the same as the column widths in the table containing the data. So is there a way in javascript I can do this? I would have to find out what the width is of the table with the data and then set the width of the columns containing the header.

Twey
05-17-2006, 02:44 PM
I don't think so, no. You can try specifying the sizes in ems, but I don't know if ems applied to block elements remain in proportion to the default font size. John?