TD unable to align Center

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • yangtono
    New Member
    • Feb 2007
    • 10

    TD unable to align Center

    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:

    Code:
    <TABLE  width="100%">
    <TR>
    <TD ALIGN="top" class="line" style="font-family: Verdana, Helvetica; color: black; font-weight: bold; font-size: 12px;">
    <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>
    Page 
    <INPUT TYPE="text" NAME="in_go_page" class="textfield" SIZE="4" MAXLENGTH="4" VALUE="1">
    <INPUT TYPE="button" VALUE="Go" class="buttonstyle" onClick="goPage();">
    of  327
    <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>
    </TD>
    </TR>
    </TABLE>
    
            <table border="0" align="center" cellpadding="0" cellspacing="0" bgcolor="#666666">
               <tr> 
                   <td colspan="2" align="left" valign="top" bgcolor="#9BCDE6"><img src="/wms-img2/tleft_top.gif" width="10" height="10"></td>
                   <td colspan="2" align="right" valign="top" bgcolor="#9BCDE6"><img src="/wms-img2/tright_top.gif" width="10" height="10"></td>
               </tr>
               <tr> 
                 <td width="11" bgcolor="#9BCDE6" class="sidetablewidth">&nbsp;</td>
                 <td colspan="2">
                 <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> 
    <THEAD>
                <tr class="headerColor">
    <TD ALIGN="Center"  CLASS="headerColor" >Pallet Number</TD>
    <TD ALIGN="Center"  CLASS="headerColor" >Location</TD>
    <TD ALIGN="Center"  CLASS="headerColor" >Owner Code</TD>
    <TD ALIGN="Center"  CLASS="headerColor" >Product</TD>
    <TD ALIGN="Center"  CLASS="headerColor" >Lot Number</TD>
    <TD ALIGN="Center"  CLASS="headerColor" >Serial Number</TD>
    <TD ALIGN="Center"  CLASS="headerColor" >Expiry Date</TD>
    <TD ALIGN="Center"  CLASS="headerColor" >ASN Number</TD>
    <TD ALIGN="Center"  CLASS="headerColor" >Document Number( Receipt Number)</TD>
    </tr></THEAD>
    Any idea how I can align all the line into Center?

    Thanks in advance.
  • AricC
    Recognized Expert Top Contributor
    • Oct 2006
    • 1885

    #2
    Originally posted by yangtono
    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:

    Code:
    <TABLE  width="100%">
    <TR>
    <TD ALIGN="top" class="line" style="font-family: Verdana, Helvetica; color: black; font-weight: bold; font-size: 12px;">
    <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>
    Page 
    <INPUT TYPE="text" NAME="in_go_page" class="textfield" SIZE="4" MAXLENGTH="4" VALUE="1">
    <INPUT TYPE="button" VALUE="Go" class="buttonstyle" onClick="goPage();">
    of  327
    <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>
    </TD>
    </TR>
    </TABLE>
    
            <table border="0" align="center" cellpadding="0" cellspacing="0" bgcolor="#666666">
               <tr> 
                   <td colspan="2" align="left" valign="top" bgcolor="#9BCDE6"><img src="/wms-img2/tleft_top.gif" width="10" height="10"></td>
                   <td colspan="2" align="right" valign="top" bgcolor="#9BCDE6"><img src="/wms-img2/tright_top.gif" width="10" height="10"></td>
               </tr>
               <tr> 
                 <td width="11" bgcolor="#9BCDE6" class="sidetablewidth">&nbsp;</td>
                 <td colspan="2">
                 <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> 
    <THEAD>
                <tr class="headerColor">
    <TD ALIGN="Center"  CLASS="headerColor" >Pallet Number</TD>
    <TD ALIGN="Center"  CLASS="headerColor" >Location</TD>
    <TD ALIGN="Center"  CLASS="headerColor" >Owner Code</TD>
    <TD ALIGN="Center"  CLASS="headerColor" >Product</TD>
    <TD ALIGN="Center"  CLASS="headerColor" >Lot Number</TD>
    <TD ALIGN="Center"  CLASS="headerColor" >Serial Number</TD>
    <TD ALIGN="Center"  CLASS="headerColor" >Expiry Date</TD>
    <TD ALIGN="Center"  CLASS="headerColor" >ASN Number</TD>
    <TD ALIGN="Center"  CLASS="headerColor" >Document Number( Receipt Number)</TD>
    </tr></THEAD>
    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

    Comment

    • yangtono
      New Member
      • Feb 2007
      • 10

      #3
      Originally posted by AricC
      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

      Code:
      <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>
      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?

      Comment

      Working...