tags:

views:

231

answers:

3

I've got a table like this:

<table border=1 style="width: 100%">
 <tbody>
    <tr>
      <td>
        squish this one
      </td>
      <td>
        expand this one
      </td>
    </tr>
  </tbody>
</table>

I'd like the left column to be as narrow as possible, and the right column to take up the rest of the screen. Is this possible?

+1  A: 

Give the second column style="width:100%" as well.

Chad Birch
+1  A: 

"as narrow as possible" is zero width or one pixel. You can achieve that with width=0 or 1px. Do you mean something different?

Joe Koberg
+1  A: 
<table border=1 style="width: 100%">
<tbody>
    <tr>
      <td width="1">
        squish this one
      </td>
      <td width="*">
        expand this one
      </td>
    </tr>
  </tbody>
</table>
cobbal
This is correct perspec, but ‘n*’ width is typically not supported by browsers. The example works anyway due to the combination of full width on the parent table and minimal width on the left, which is usually the best approach.
bobince
(%-width typically works on browsers, but isn't quite right according to spec — a 100% column plus a fixed-width left width would add up to more than 100% of the parent size.)
bobince