Debt Consolidation - Wordpress Theme - Wordpress Theme - Find jobs - Loans

PDA

View Full Version : How to set table column width?


globalcashsite
May 16th 2009, 3:23 am
Guys

I have 6 columns in one php table as follows:

<<<<<< Table Heading >>>>>>>
Col1 Col2 Col3 Col4 Col5 Col6

Table heading will span and in center of all columns. And I don't want to that lower row columns adjust automatically. I want to adjust width of these lowe row columns myself. I tried many things but these are not working.

Earlier table heading column was using "colspn=6" and I tried to set width of lower columns by using width="10" commands but that did not work.

Then I removed "colspn" command from table heading column and lower column widths were decreased automatically. Then I tried to change width by width="10" command but that is not changing field width. Right now I am using these commands

<TD bgcolor="blue" align="left" width=12>S.No</TD>
<TD bgcolor="red" align="left" width=12>Tran Date</TD>
<TD bgcolor="green" align="left" width=7>W.Days</TD>
<TD bgcolor="navy" align="left" width=10>Invoice No</TD>
<TD bgcolor="yellow" align="right" width=15>Amount</TD>
<TD bgcolor="pink" align="left" width=50>Transaction Remarks</TD>

But columns are not being adjusted according to above commands.

Please help me how I can set column widths myself as I required.

Thank you

GCS

Bohra
May 16th 2009, 4:34 am
Like this i guess

<table border="1" width="500px">
<tr>

<TD bgcolor="blue" align="left" width=12>S.No</TD>
<TD bgcolor="red" align="left" width=12>Tran Date</TD>
<TD bgcolor="green" align="left" width=7>W.Days</TD>
<TD bgcolor="navy" align="left" width=10>Invoice No</TD>
<TD bgcolor="yellow" align="right" width=15>Amount</TD>
<TD bgcolor="pink" align="left" width=50>Transaction Remarks</TD>
</tr>
</table>

alfa_375
May 16th 2009, 5:03 am
This should definitely work.


<table border="1" width="500px">
<tr>

<TD bgcolor="blue" align="left" width="12">S.No</TD>
<TD bgcolor="red" align="left" width="100">Tran Date</TD>
<TD bgcolor="green" align="left" width="7">W.Days</TD>
<TD bgcolor="navy" align="left" width="70">Invoice No</TD>
<TD bgcolor="yellow" align="right" width="15">Amount</TD>
<TD bgcolor="pink" align="left" width="130">Transaction Remarks</TD>
</tr>
</table>

globalcashsite
May 16th 2009, 5:38 am
Guys

Problem is solved. Bohra's code gave me hint. In fact I was doing right thing but I was under estimating pixels. When I read "500px" in his code then I remembered that I am mixing up pixels with number of characters. I just increased width from "12" to "60" for first columns and so on and every thing got perfect. :)

Thank you for helping me.

GCS

Bohra
May 16th 2009, 5:40 am
Guys

Problem is solved. Bohra's code gave me hint. In fact I was doing right thing but I was under estimating pixels. When I read "500px" in his code then I remembered that I am mixing up pixels with number of characters. I just increased width from "12" to "60" for first columns and so on and every thing got perfect. :)

Thank you for helping me.

GCS

Great you got it fixed :D