Reputation: 3896
I have an asp.net table with 1 row and 2 cells in each row. I am trying to get the right cell to display near the right most edge of the cell with no success.
<asp:Table runat="server" ID="tblMyTable" BorderStyle="Solid" BorderWidth="1" BorderColor="Black" Font-Names="Arial" BackColor="White" Width="190" ClientIDMode="Static">
<asp:TableRow Font-Names="Arial Black">
<asp:TableCell HorizontalAlign="Left" CssClass="HeaderPadding">
<asp:Label runat="server" ID="lblID" Text="361299"></asp:Label>
</asp:TableCell>
<asp:TableCell HorizontalAlign="Right">
<asp:Label runat="server" ID="lblPercentage" Text="79%"></asp:Label>
</asp:TableCell>
</asp:TableRow>
</Asp:Table>
<style>
.HeaderPadding
{
padding:0px 0px 10px 0px;
}
</style>
I want to display like this:
How can I align the percentage label correctly?
instead it looks like this for some cells but looks ok in others.
Upvotes: 0
Views: 20517
Reputation: 63065
you can use css class like below
<style type="text/css">
.rightAlign { text-align:right; }
</style>
in your label
<asp:Label runat="server" ID="lblPercentage" Text="79%" CssClass="rightAlign"></asp:Label>
Upvotes: 0
Reputation: 3289
Try this:
<table>
<tr>
<td class="HeaderPadding">
<asp:Label runat="server" ID="lblID" Text="361299"></asp:Label>
</td>
<td style="text-align: right">
<asp:Label runat="server" ID="lblPercentage" Text="79%"></asp:Label>
</td>
</tr>
</table>
Upvotes: 3