472,102 Members | 2,115 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 472,102 software developers and data experts.

how to make a TD take up remaining width?


I'm trying to use css to set the widths of cells and tables, for
multiple tables.

The width of the tables is 450px, set in stylesheet.

The number of columns and widths vary, but I'd like one column to
stretch and take up any remaining space.

I've set the width of the table to 450px in my stylesheet. And TD's all
have classes that set their width to a certain amount of pixels in an
external stylesheet, except for the one column that needs to stretch.
If I set that one column to width="100%" the table exceeds 450px and
breaks my layout.

This is what is would look like, for example:

<table class="master">
<td class="date"></td>
<td class="type"></td>
<td class="total"></td>

<table class="master">
<td class="num"></td>
<td class="date"></td>
<td class="location"></td>
<td class="type"></td>


table.master {width:450px}
table.master td.num {width:45px}
table.master td.location {width:90px}
table.master td.total {width:135px}
table.master td.type {width:60px}
table.master td.num {width:100%}

Nov 23 '05 #1
0 1505

This discussion thread is closed

Replies have been disabled for this discussion.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.