ytba92 ytba92 - 21 days ago 5
ASP.NET (C#) Question

Cannot display table in desired format

I have the following HTML:

<table cellspacing="10px" cellpadding="10px" width="100%" style="border-spacing: 10px">
<tr align="left">
<td>
<asp:Label ID="Label0" runat="server" Text="<%$ Resources:Strings, OrderReference %>" />
<asp:Label ID="TRANS_NB_LB" runat="server" />
<asp:Label ID="Label5" runat="server" TabIndex="5" Text="<%$ Resources:Strings, Shipment %>" />
<asp:Label ID="SHIP_COST_LB" runat="server" />
</td>
</tr>
<tr align="left">
<td>
<asp:Label ID="Label1" runat="server" TabIndex="5" Text="<%$ Resources:Strings, OrderAmount %>" />
<asp:Label ID="TRANS_AMOUNT_LB" runat="server" />
<asp:Label ID="Label2" runat="server" TabIndex="5" Text="<%$ Resources:Strings, ShippingMethod %>" />
<asp:Label ID="SHIPP_METH_LB" runat="server" />
</td>
</tr>
<tr align="left">
<td>
<asp:Label ID="Label3" runat="server" TabIndex="5" Text="<%$ Resources:Strings, Date %>" />
<asp:Label ID="TRANS_DATE_LB" runat="server" />
<%-- --%>
</td>
</tr>
<tr>
<td>
<asp:Label ID="Label4" runat="server" TabIndex="5" Text="<%$ Resources:Strings, BillNumber %>" />
<asp:Label ID="SHIP_BILL_NUMBER_LB" runat="server" />
<%-- --%>
</td>
</tr>
</table>


It displays the following table:

demonstration

I'd like to fix the columns so that they are properly displayed under each other such as: (Replace "_" by space)

Order Reference__OSP-00060000308__________Shipment_________100.00000.

Order Amount_____879.00000________________Shipping Method.

Date_____________7/13/2016 11:17:38 AM.

Bill Number______SHIP-000000000227.


How do I fix that? How can I add border spacing? Also is there a way I can add ":" after the element names (such as Order Reference: )?

Answer

Sorry I'm new at this, found my answer:

<table cellspacing="10px" cellpadding="10px" width="100%" style="border-spacing: 10px">
  <tr align="left">
    <td>
      <asp:Label ID="Label0" runat="server" Text="<%$ Resources:Strings, OrderReference %>" />
    </td>
    <td>
      <asp:Label ID="TRANS_NB_LB" runat="server" />
    </td>
    <td>
      <asp:Label ID="Label5" runat="server" TabIndex="5" Text="<%$ Resources:Strings, Shipment %>" />
    </td>
    <td>
      <asp:Label ID="SHIP_COST_LB" runat="server" />
    </td>
  </tr>
  <tr align="left">
    <td>
      <asp:Label ID="Label1" runat="server" TabIndex="5" Text="<%$ Resources:Strings, OrderAmount %>" />
    </td>
    <td>
      <asp:Label ID="TRANS_AMOUNT_LB" runat="server" />
    </td>
    <td>
      <asp:Label ID="Label2" runat="server" TabIndex="5" Text="<%$ Resources:Strings, ShippingMethod %>" />
    </td>
    <td>
      <asp:Label ID="SHIPP_METH_LB" runat="server" />
    </td>
  </tr>
  <tr align="left">
    <td>
      <asp:Label ID="Label3" runat="server" TabIndex="5" Text="<%$ Resources:Strings, Date %>" />
    </td>
    <td>
      <asp:Label ID="TRANS_DATE_LB" runat="server" />
    </td>
  </tr>
  <tr>
    <td>
      <asp:Label ID="Label4" runat="server" TabIndex="5" Text="<%$ Resources:Strings, BillNumber %>" />
    </td>
    <td>
      <asp:Label ID="SHIP_BILL_NUMBER_LB" runat="server" />
    </td>
  </tr>
</table>

Hope I didn't waste your time and that this may be useful for noobs like me :)