Results 1 to 3 of 3

Thread: Cannot align table

  1. #1

    Thread Starter
    King of sapila
    Join Date
    Oct 2006
    Location
    Greece
    Posts
    6,222

    Cannot align table

    Hi. I'm trying to center the table to display in the center of screen, however whatever I tried does not do that (margin,align etc).
    Any ideas (I'm including the align so you can see where is the start of the div).
    Thanks

    Code:
      <div id="divextend" style="margin:0px; align="center";"  >
                     <br /><br />
         
                 <table>
                     <tr >
                         <td >
                      <asp:Panel ID="Panel2" runat="server" Visible="false">
                          <div style="margin:0px auto; display:block; width:1500px">
              <table style="border:solid;width:45%; border-color:black;">      
                <tr>
                    <td colspan="2">                  
                        <telerik:RadLabel runat="server" Text="Ημ/νία Έκδοσης:" Width="150"></telerik:RadLabel>                   
                        <telerik:RadTextBox  runat="server" Text="" ID="fldDatecreated" Enabled="false" BackColor="LightYellow"></telerik:RadTextBox>
                    </td>
                              
                </tr>
                  <tr>
                      <td colspan="2">                      
                           <telerik:RadLabel runat="server" Text="Ημ/νία Λήξης:" Width="150"></telerik:RadLabel>                    
                           <telerik:RadTextBox  runat="server" Text="" ID="fldDateexpire" Enabled="false" BackColor="LightYellow"></telerik:RadTextBox>
                          </td>
                  </tr>
    
                   <tr>
                      <td colspan="2">
                           <telerik:RadLabel runat="server" Text="Αρχικό Ποσό:" Width="150"></telerik:RadLabel>
                           <telerik:RadTextBox  runat="server" Text="" ID="fldInitialamount" Enabled="false" BackColor="LightYellow"></telerik:RadTextBox>
                          </td>
                       </tr>
    
                     <tr>
                      <td colspan="2">
                           <telerik:RadLabel runat="server" Text="Υπόλοιπο Ποσό:" Width="150"></telerik:RadLabel>
                           <telerik:RadTextBox  runat="server" Text="" ID="fldRefundamount" Enabled="false" BackColor="LightYellow"></telerik:RadTextBox>
                          </td>
                       </tr>
    
                     <tr>
                      <td colspan="2">
                           <telerik:RadLabel runat="server" Text="Επέκταση-Ημέρες:" Width="150"></telerik:RadLabel>
                          <telerik:RadComboBox ID="fldDays" runat="server">
                            <Items>
                                 <telerik:RadComboBoxItem Value="5" Text="5" />
                                <telerik:RadComboBoxItem Value="15" Text="15" />
                                <telerik:RadComboBoxItem Value="30" Text="30" />
                                <telerik:RadComboBoxItem Value="60" Text="60" />
                            </Items>
                        </telerik:RadComboBox>
                          </td>
                       </tr>
    
                       <tr>                
                        <td style="text-align:center;">
                      <br />              
                         <telerik:RadButton ID="ReturnButton1" Text="Επέκταση Πιστωτικού" OnClientClicked="
                              OnClientItemClicked"  runat="server" Width="158px" Visible="true" OnClick="ReturnButton1_Click">
                         </telerik:RadButton>
                        </td>
                       </tr>
    
                  </table>
                              </div>
                          </asp:Panel>
                          </td>
                          </tr>
                                 </table>
                                                                  
    
                    </div>
    ἄνδρα μοι ἔννεπε, μοῦσα, πολύτροπον, ὃς μάλα πολλὰ
    πλάγχθη, ἐπεὶ Τροίης ἱερὸν πτολίεθρον ἔπερσεν·

  2. #2
    Smooth Moperator techgnome's Avatar
    Join Date
    May 2002
    Posts
    33,918

    Re: Cannot align table

    Drop the align, set margin: atuo;


    also, if you plan to use quotes for properties like margin or align, either 1) don't use quotes internally
    Code:
    style="margin:0px; align=center;"  >
    or 2) if you insist, use the opposite quoting marks:
    Code:
    style="margin:0px; align='center';"  >
    And lastly, the = isn't used in the style tag:
    Code:
    style="margin:0px; align:center;"  >
    But it would be used in the TABLE's align property, in that case you would use quote marks.
    Code:
    style="margin:0px;" align='center';"  >
    Personally when I need to center an HTML object, I manipulate the margin style property.

    Code:
    style="margin:auto;"  >

    -tg
    * I don't respond to private (PM) requests for help. It's not conducive to the general learning of others.*
    * I also don't respond to friend requests. Save a few bits and don't bother. I'll just end up rejecting anyways.*
    * How to get EFFECTIVE help: The Hitchhiker's Guide to Getting Help at VBF - Removing eels from your hovercraft *
    * How to Use Parameters * Create Disconnected ADO Recordset Clones * Set your VB6 ActiveX Compatibility * Get rid of those pesky VB Line Numbers * I swear I saved my data, where'd it run off to??? *

  3. #3

    Thread Starter
    King of sapila
    Join Date
    Oct 2006
    Location
    Greece
    Posts
    6,222

    Re: Cannot align table

    Closest I can get is do this on the table:
    <table style="border:solid;width:45%; border-color:black;margin:0px auto;display:block;">

    It aligns somewhat, not completely centered but better than everything I check. The issue here is that ReturnButton1 moves a little to the left (I could "push" it probably)
    ἄνδρα μοι ἔννεπε, μοῦσα, πολύτροπον, ὃς μάλα πολλὰ
    πλάγχθη, ἐπεὶ Τροίης ἱερὸν πτολίεθρον ἔπερσεν·

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width