By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
434,711 Members | 2,158 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 434,711 IT Pros & Developers. It's quick & easy.

TD unable to align Center

P: 10
Hi,

I am creating a table to list some data. The table is using a sorting and highlight function that I found from the net.

I can't attach image here, basically html will wrap the heading, therefore I notice the second line of the header is left align instead of centering. I believe it's because of the sort.htc script that will output an arrow when user click on the header to sort.

The code is as below:

Expand|Select|Wrap|Line Numbers
  1. <TABLE  width="100%">
  2. <TR>
  3. <TD ALIGN="top" class="line" style="font-family: Verdana, Helvetica; color: black; font-weight: bold; font-size: 12px;">
  4. <A HREF="#" class="nounderlinelink" onClick="clickImg('previous');"><IMG SRC="/wms-img2/arr_prev.gif" ALIGN="bottom" ALT="Previous" width="16" height="13" border="0"></A>
  5. Page 
  6. <INPUT TYPE="text" NAME="in_go_page" class="textfield" SIZE="4" MAXLENGTH="4" VALUE="1">
  7. <INPUT TYPE="button" VALUE="Go" class="buttonstyle" onClick="goPage();">
  8. of  327
  9. <A HREF="#" class="nounderlinelink" onClick="clickImg('next');"><IMG SRC="/wms-img2/arr_next.gif" ALIGN="bottom" ALT="Next" width="16" height="13" border="0"></A>
  10. </TD>
  11. </TR>
  12. </TABLE>
  13.  
  14.         <table border="0" align="center" cellpadding="0" cellspacing="0" bgcolor="#666666">
  15.            <tr> 
  16.                <td colspan="2" align="left" valign="top" bgcolor="#9BCDE6"><img src="/wms-img2/tleft_top.gif" width="10" height="10"></td>
  17.                <td colspan="2" align="right" valign="top" bgcolor="#9BCDE6"><img src="/wms-img2/tright_top.gif" width="10" height="10"></td>
  18.            </tr>
  19.            <tr> 
  20.              <td width="11" bgcolor="#9BCDE6" class="sidetablewidth">&nbsp;</td>
  21.              <td colspan="2">
  22.              <table width="100%" border="0" cellspacing="1" cellpadding="3"  style="behavior:url(/wms-img2/css/tablehl.htc) url(/wms-img2/css/sort.htc);" slcolor=#6C9CFF hlcolor=#FFFFCC> 
  23. <THEAD>
  24.             <tr class="headerColor">
  25. <TD ALIGN="Center"  CLASS="headerColor" >Pallet Number</TD>
  26. <TD ALIGN="Center"  CLASS="headerColor" >Location</TD>
  27. <TD ALIGN="Center"  CLASS="headerColor" >Owner Code</TD>
  28. <TD ALIGN="Center"  CLASS="headerColor" >Product</TD>
  29. <TD ALIGN="Center"  CLASS="headerColor" >Lot Number</TD>
  30. <TD ALIGN="Center"  CLASS="headerColor" >Serial Number</TD>
  31. <TD ALIGN="Center"  CLASS="headerColor" >Expiry Date</TD>
  32. <TD ALIGN="Center"  CLASS="headerColor" >ASN Number</TD>
  33. <TD ALIGN="Center"  CLASS="headerColor" >Document Number( Receipt Number)</TD>
  34. </tr></THEAD>
  35.  
Any idea how I can align all the line into Center?

Thanks in advance.
Mar 10 '08 #1
Share this Question
Share on Google+
2 Replies


Expert 100+
P: 1,892
Hi,

I am creating a table to list some data. The table is using a sorting and highlight function that I found from the net.

I can't attach image here, basically html will wrap the heading, therefore I notice the second line of the header is left align instead of centering. I believe it's because of the sort.htc script that will output an arrow when user click on the header to sort.

The code is as below:

Expand|Select|Wrap|Line Numbers
  1. <TABLE  width="100%">
  2. <TR>
  3. <TD ALIGN="top" class="line" style="font-family: Verdana, Helvetica; color: black; font-weight: bold; font-size: 12px;">
  4. <A HREF="#" class="nounderlinelink" onClick="clickImg('previous');"><IMG SRC="/wms-img2/arr_prev.gif" ALIGN="bottom" ALT="Previous" width="16" height="13" border="0"></A>
  5. Page 
  6. <INPUT TYPE="text" NAME="in_go_page" class="textfield" SIZE="4" MAXLENGTH="4" VALUE="1">
  7. <INPUT TYPE="button" VALUE="Go" class="buttonstyle" onClick="goPage();">
  8. of  327
  9. <A HREF="#" class="nounderlinelink" onClick="clickImg('next');"><IMG SRC="/wms-img2/arr_next.gif" ALIGN="bottom" ALT="Next" width="16" height="13" border="0"></A>
  10. </TD>
  11. </TR>
  12. </TABLE>
  13.  
  14.         <table border="0" align="center" cellpadding="0" cellspacing="0" bgcolor="#666666">
  15.            <tr> 
  16.                <td colspan="2" align="left" valign="top" bgcolor="#9BCDE6"><img src="/wms-img2/tleft_top.gif" width="10" height="10"></td>
  17.                <td colspan="2" align="right" valign="top" bgcolor="#9BCDE6"><img src="/wms-img2/tright_top.gif" width="10" height="10"></td>
  18.            </tr>
  19.            <tr> 
  20.              <td width="11" bgcolor="#9BCDE6" class="sidetablewidth">&nbsp;</td>
  21.              <td colspan="2">
  22.              <table width="100%" border="0" cellspacing="1" cellpadding="3"  style="behavior:url(/wms-img2/css/tablehl.htc) url(/wms-img2/css/sort.htc);" slcolor=#6C9CFF hlcolor=#FFFFCC> 
  23. <THEAD>
  24.             <tr class="headerColor">
  25. <TD ALIGN="Center"  CLASS="headerColor" >Pallet Number</TD>
  26. <TD ALIGN="Center"  CLASS="headerColor" >Location</TD>
  27. <TD ALIGN="Center"  CLASS="headerColor" >Owner Code</TD>
  28. <TD ALIGN="Center"  CLASS="headerColor" >Product</TD>
  29. <TD ALIGN="Center"  CLASS="headerColor" >Lot Number</TD>
  30. <TD ALIGN="Center"  CLASS="headerColor" >Serial Number</TD>
  31. <TD ALIGN="Center"  CLASS="headerColor" >Expiry Date</TD>
  32. <TD ALIGN="Center"  CLASS="headerColor" >ASN Number</TD>
  33. <TD ALIGN="Center"  CLASS="headerColor" >Document Number( Receipt Number)</TD>
  34. </tr></THEAD>
  35.  
Any idea how I can align all the line into Center?

Thanks in advance.
In the style tag why don't you add text-align: center if you want to center some text. Also your table looks somewhat like malformed HTML
Mar 11 '08 #2

P: 10
In the style tag why don't you add text-align: center if you want to center some text. Also your table looks somewhat like malformed HTML
Hi,

I did according to your suggestion

Expand|Select|Wrap|Line Numbers
  1. <table width="100%" border="0" cellspacing="1" cellpadding="3"  style="behavior:url(/wms-img2/css/tablehl.htc) url(/wms-img2/css/sort.htc) text-align:center" slcolor=#6C9CFF hlcolor=#FFFFCC> 
  2.  
The result is the same. Because I didn't specify NOWRAP, so the label like "Quantity On Hand" will become 3 lines, with second and third line align more to left instead of center.

By the way, what do you mean by malformed HTML?
Mar 11 '08 #3

Post your reply

Sign in to post your reply or Sign up for a free account.