You might want to look into using col's and colgroup's:
<table style="width: 200px;">
<colgroup>
<col id="col1" />
<col id="col2" />
</colgroup>
<thead>
<tr>
<th>Column 1</th>
<th>Column 2</th>
</tr>
</thead>
<tbody>
<tr>
<td>Test string</td>
<td>Test string</td>
</tr>
</tbody>
</table>
That you have one element you can set the width on. You're supposed to
be able to set the style (color, font-weight, etc..) of each column,
but in my experience this isn't very well supported. For a change it's
not Firefox that adheres to W3C standards but IE (both 6 & 7)...
Setting the width works like a charm though...
For more info on columns in tables look here:
http://www.w3.org/TR/html401/struct/tables.html#h-11.2.4
Greetz,
Wizz
On Nov 22, 3:59 pm, dasboe <[EMAIL PROTECTED]> wrote:
> how do I resize table columns the right way. I simply tried the
> following:
>
> $('col1').setStyle({width: '30%'});
> $('col2').setStyle({width: '70%'});
>
> on:
>
> <table id="table1" style="width: 200px;">
> <tbody>
> <tr>
> <td id="col1" style="width: 50%">
> col1
> </td>
> <td id="col2" style="width: 50%">
> col2
> </td>
> </tr>
> </tbody>
> </table>
>
> it works fine for IE, Firefox, Safari but fails for Opera so I
> wondered if this is the right way of doing this.
> thanks Björn
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Ruby
on Rails: Spinoffs" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at
http://groups.google.com/group/rubyonrails-spinoffs?hl=en
-~----------~----~----~----~------~----~------~--~---