Click to See Complete Forum and Search --> : td widths when table width is 100%


jslady
12-02-2003, 10:33 AM
I need clarification on how the table cell widths should be calculated when you are using percentages.

Until now I have always calculated my cell widths so that their combined value equals the value of the table width.

ie.

<table width = "80%"><tr>
<td width = "50%">
<td width ="30%">
<tr></table>

However, recently I was challenged on this and it was suggested that the combined value of the table cell widths should always equal 100% and it is only the table width percentage that needs to be changed.

<table width="80%">
<td width = "63%">
<td width ="37%">
<tr></table>


Although I know this method can work, I'm not sure if its "good" code and I thought what I was doing was correct.
Please could someone clarify.

Any help appreciated.

Regards,

JsLady

spufi
12-02-2003, 10:45 AM
The second way is correct because it is using the percentage of what tag it is in. Just like the <table> tag is going off of the <body> tag's size, the <td> tag is using a percentage of what the <table> tag is. If the <table> tag is 80% wide, and the <td> tag is 50% wide, the <td> tag is actually 40% of the the <body> tag.

jslady
12-02-2003, 10:51 AM
thanks for that spufi.

Regards,

JsLady