Tables and column sizes

  • Thread starter Thread starter Iams
  • Start date Start date
I

Iams

What do I have to do to get a column in a table to stay the same size no
matter what is in the other tables?

I've tried setting the width in px, in percentages, and nothing seems to
work; for example, the columns that are colored #cccccc I want to stay the
size of the menu control, which doesn't change.

However, if the column to the right of it, with the ucGeneral and ucDetails
controls, has nothing in it, or something very small, the #cccccc column
spreads out and I don't want it to do that. What's the secret.

<table runat=server bgcolor=white border=0 bordercolor=black height="100%"
width="100%" cellspacing=0 cellpadding=0 ID="Table1">
<tr height="10%" width="100%">
<td colspan=5><uc1:ucHeader id=UcHeader1
runat="server"></uc1:ucHeader></td>
</tr>
<tr valign=top>
<td bgcolor="#cccccc" rowspan=3 style="WIDTH: 10px">&nbsp;</td>
<td bgcolor="#cccccc" rowspan=3 style="WIDTH: 10px"><uc1:ucMenu
id=UcMenu1 runat="server"></uc1:ucMenu></td>
<td bgcolor="#cccccc" rowspan=3 style="WIDTH: 10px">&nbsp;</td>
<td bgcolor="white" rowspan=3>&nbsp;</td>
</tr>
<tr valign=top width="100%"><td valign=top><uc1:ucGeneral id=UcGeneral1
runat="server"></uc1:ucPointOfDiversionGeneral></td></tr>
<tr valign=top height="100%" width="100%"><td valign=top><uc1:ucDetails
id=UcDetails1 runat="server"></uc1:ucDetails></td>
</tr>
</table>


Thanks.
 
In the column you want to be fixed, add the "nowrap" option in the TD tag.
For the column to the right, set it's width to 100%.

You could also try putting the contents of the fixed cell in a table of it's
own with a fixed size and aligned either center, left, or right. If the
right
column changes, it won't change how the nested table looks to the user.

--
2005 Microsoft MVP C#
Robbe Morris
http://www.robbemorris.com
http://www.mastervb.net/home/ng/forumvbcode/post10017013.aspx
http://www.eggheadcafe.com/articles/adonet_source_code_generator.asp
 
For the table set css rule table_layout:fixed; then specify the width for
the columns in the first row.

Eliyahu
 
Great ideas! Thanks so much!
Robbe Morris said:
In the column you want to be fixed, add the "nowrap" option in the TD tag.
For the column to the right, set it's width to 100%.

You could also try putting the contents of the fixed cell in a table of it's
own with a fixed size and aligned either center, left, or right. If the
right
column changes, it won't change how the nested table looks to the user.

--
2005 Microsoft MVP C#
Robbe Morris
http://www.robbemorris.com
http://www.mastervb.net/home/ng/forumvbcode/post10017013.aspx
http://www.eggheadcafe.com/articles/adonet_source_code_generator.asp
 
Back
Top