Win a copy of The Java Performance Companion this week in the Performance forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

2 columns both having unspecified widths

 
Ramakrishnan Viswanathan
Ranch Hand
Posts: 90
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi All

I need to create the following structure. I have a table with 1 row having 2 columns.

The first column has content whose width might vary depending on the length of the actual content. The second column needs to span from the end of the first column all the way to the end of the table. The structure that I am trying to build goes something like this.

one css class defined
.columnWidth {width:auto}

<table>
<tr>
<td class="columnWidth">
some content goes in here
</td>
<td>
some other content
</td>
<tr>
</table>


The first column has "auto" width and it expands automatically based on the content inside it. But the second column's width is determined by its content and does NOT actually expand all the way to the end of the table.

Can someone let me know if this is doable? Or is there any other way to solve this problem?

Thanks so much
Ram
 
Eric Pascarello
author
Rancher
Posts: 15385
6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Did you set the width of the table to a fixed amount?

Eric
 
Subhadip Chatterjee
Ranch Hand
Posts: 93
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Man,
your table has only one row with two TDs...in normal case, table's first row defines the structure for the whole Table.Now, what i don't understand is how does your 2nd TD not end up at the right hand border of Table? Both the TDs are supposed to take the whole table width space, right!!!
 
Ramakrishnan Viswanathan
Ranch Hand
Posts: 90
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The table width is fixed to 100%.

Now let us assume that the first Td is 70% (this could vary). What i thought was the second Td will span for the remaining 30%. But this does not happen if the first Td has a width of "auto". If I do not give the width as "auto", the first Td's width does not vary based on the content.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic