Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Trivial But Irritating Problem

Status
Not open for further replies.

arpan

Programmer
Oct 16, 2002
336
IN
Consider this HTML table which I am displaying in a web page
Code:
---------------------------------------------------------
Name      Total Amount     Amount Paid        Bal.
---------------------------------------------------------
Charles     50000.00         50000.00         0.00
Mary        75000.00         75000.00         0.00
Ben          4000.00          2500.00         0.00
Diana       15000.00          4000.00         0.00
Mike        25000.00         25000.00         0.00       
---------------------------------------------------------
In the above table, all the amounts are right-aligned in each <td>. As you can see, the amounts under the 'Bal.' column are all 0.00. As a result, the width of this column becomes smaller than the rest of the three columns. To ensure that the width of all the 4 columns are more or less the same, what I did for the amounts under the Bal. column is introduced width=60 i.e.

<td align=right width=60>

so that even if all the amounts under the Bal. column are zero, its width will look more or less the same as the width of the other 3 columns. Note that I have put width=60 for the amounts in the Bal. column only - not in the other 3 columns. But now what happens is since I have introduced width=60, the amounts in the Bal. column are not pushed towards the extreme right side of the <td>. These amounts get shifted slightly towards the left hand side. If I remove width=60 then this problem doesn't come up. How do I ensure that the amounts are displayed towards the extreme right hand side of the <td> inspite of specifying the width of the <td>?

Thanks,

Arpan
 
Try this:

<td align=&quot;right&quot; width=60 style=&quot;padding-right:0&quot;>

Hope this helps,
Erik <-- My sport: Boomerang throwing !!
!! Many Happy Returns !! -->
 
Hi Erik,

Thanks for your suggestion but sorry to say that it didn't work out. Any other suggestions?????

Regards,

Arpan
 
I don't think I get the gist of the question myself...

But have you tried being sure the </td> is on the same line in your code as the content?

Like:

Stuff</td>

and not:

Stuff
</td>

?




 
Hello Friend,

Thanks for your response. I guess I haven't framed my question as clearly as it should have been framed. Anyway, since you couldn't exactly follow the question, visit the following URL:


Now have a look at all the records (all are 0.00) under the HMAIN column in TABLE 1. All of them are right-aligned as expected. But have a look at all the records under the LCASH column. Notice the difference in how the 0.00s are displayed in the columns HMAIN & LCASH. Note that except for the <td>s in the 1st 3 columns i.e. S.NO., ECODE & NAME, the rest of the <td>s are all coded as:

<td align=right width=60>

The 2nd table, TABLE 2, on the other hand shows when width=60 is not specified in any of the <td>s. Have a look at the difference in the widths of the columns HMAIN & LCASH.

I hope this will clarify all your doubts. Any suggestions to overcome this problem??????

Regards,

Arpan
 
The problem is that you should only have width=60 in the column headers e.g.:

<th><font color=white width=60>LCASH</th>

and not in the <td>s...so they would be something like:
<td align=right nowrap>0.00</td>
<td align=right nowrap>1645.00</td>
etc.

That will sort it,

Kev
[afro2]

P.S. sounds a bit like you think the people here are wrong for not understanding you... we work with what we've got....enough said :)
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top