I have an ASP:Table with 3 columns and 2 rows. In each cell a number displays. It's important that the numbers are vertically and horizontally aligned with each other. In the left column for both rows I also place a short label of 5 characters describing what that row is. My problem is that when I put the label(s) there, it forces the number in the first column up or down so that it then is not horizontally aligned with the numbers in the 2 other columns. Also, if the numbers display at a smaller font, then the first number gets shoved higher than the numbers to the right - but if the numbers display at a larger font, then the first number gets shoved downward in relation to the numbers in the right 2 columns. Also, I would say that the label and the values for columns 2 and 3 do not exactly line up horizontally. When the values are at a small font, then the label tends to be slightly lower than columns 2 and 3 - and when the values are at a larger font, the labels tend to be slightly higher than columns 2 or 3. But the main problem is the column 1 value being so much higher or lower than the values in the other columns.
I'll try to represent the page runs:
"Small value font":
---- COLUMN 1 ---- ---- COLUMN 2 ---- ---- COLUMN 2 ----
11
Label1 22 33
44
Label2 55 66
========================================================
"Large value font":
---- COLUMN 1 ---- ---- COLUMN 2 ---- ---- COLUMN 2 ----
Label1 22 33
11
Label2 55 66
44
=========================================================
"Without any labels":
11 22 33
44 55 66
==========================================================
Here is the pertinent ASP.NET code:
<style type="text/css">
.valuesAlign
{
margin-right: 70px;
text-align:right;
font-size:smaller;
}
.leftLabel
{
float:left;
margin-left: 10px;
padding: 0px;
text-align:left;
font-size: xx-large;
}
</style>
<asp:table
id="tbl"
Font="Arial"
Font-Size="12"
GridLines="Both"
CellPadding="10"
CellSpacing="50"
HorizontalAlign="Left"
Width="100%"
Height="400"
runat="server">
<asp:TableRow
horizontalAlign="Left">
<asp:TableHeaderCell HorizontalAlign = "Right">
<asp:Label ID="Label1" runat="server" Text="Label1" CssClass="leftLabel"></asp:Label>
<asp:TextBox ID="txtboxCol1Row1" runat="server" BorderStyle="None"
CssClass="valuesAlign" Wrap="False">11</asp:TextBox>
</asp:TableHeaderCell>
<asp:TableHeaderCell Width="33%" HorizontalAlign = "Right">
<asp:TextBox ID="txtboxCol2Row1" runat="server" BorderStyle="None"
CssClass="valuesAlign" Wrap="False">22</asp:TextBox>
</asp:TableHeaderCell>
<asp:TableHeaderCell Width="33%" HorizontalAlign = "Right">
<asp:TextBox ID="txtboxCol3Row1" runat="server" BorderStyle="None"
CssClass="valuesAlign" Wrap="False">33</asp:TextBox>
</asp:TableHeaderCell>
</asp:TableRow>
<asp:TableRow
horizontalAlign="Left">
<asp:TableHeaderCell HorizontalAlign = "Right">
<asp:Label ID="Label2" runat="server" Text="Label2" CssClass="leftLabel"></asp:Label>
<asp:TextBox ID="txtboxCol1Row2" runat="server" BorderStyle="None"
CssClass="valuesAlign" Wrap="False">44</asp:TextBox>
</asp:TableHeaderCell>
<asp:TableHeaderCell Width="33%" HorizontalAlign = "Right">
<asp:TextBox ID="txtboxCol2Row2" runat="server" BorderStyle="None"
CssClass="valuesAlign" Wrap="False">55</asp:TextBox>
</asp:TableHeaderCell>
<asp:TableHeaderCell Width="33%" HorizontalAlign = "Right">
<asp:TextBox ID="txtboxCol3Row2" runat="server" BorderStyle="None"
CssClass="valuesAlign" Wrap="False">66</asp:TextBox>
</asp:TableHeaderCell>
</asp:TableRow>
</asp:table>
I'll try to represent the page runs:
"Small value font":
---- COLUMN 1 ---- ---- COLUMN 2 ---- ---- COLUMN 2 ----
11
Label1 22 33
44
Label2 55 66
========================================================
"Large value font":
---- COLUMN 1 ---- ---- COLUMN 2 ---- ---- COLUMN 2 ----
Label1 22 33
11
Label2 55 66
44
=========================================================
"Without any labels":
11 22 33
44 55 66
==========================================================
Here is the pertinent ASP.NET code:
<style type="text/css">
.valuesAlign
{
margin-right: 70px;
text-align:right;
font-size:smaller;
}
.leftLabel
{
float:left;
margin-left: 10px;
padding: 0px;
text-align:left;
font-size: xx-large;
}
</style>
<asp:table
id="tbl"
Font="Arial"
Font-Size="12"
GridLines="Both"
CellPadding="10"
CellSpacing="50"
HorizontalAlign="Left"
Width="100%"
Height="400"
runat="server">
<asp:TableRow
horizontalAlign="Left">
<asp:TableHeaderCell HorizontalAlign = "Right">
<asp:Label ID="Label1" runat="server" Text="Label1" CssClass="leftLabel"></asp:Label>
<asp:TextBox ID="txtboxCol1Row1" runat="server" BorderStyle="None"
CssClass="valuesAlign" Wrap="False">11</asp:TextBox>
</asp:TableHeaderCell>
<asp:TableHeaderCell Width="33%" HorizontalAlign = "Right">
<asp:TextBox ID="txtboxCol2Row1" runat="server" BorderStyle="None"
CssClass="valuesAlign" Wrap="False">22</asp:TextBox>
</asp:TableHeaderCell>
<asp:TableHeaderCell Width="33%" HorizontalAlign = "Right">
<asp:TextBox ID="txtboxCol3Row1" runat="server" BorderStyle="None"
CssClass="valuesAlign" Wrap="False">33</asp:TextBox>
</asp:TableHeaderCell>
</asp:TableRow>
<asp:TableRow
horizontalAlign="Left">
<asp:TableHeaderCell HorizontalAlign = "Right">
<asp:Label ID="Label2" runat="server" Text="Label2" CssClass="leftLabel"></asp:Label>
<asp:TextBox ID="txtboxCol1Row2" runat="server" BorderStyle="None"
CssClass="valuesAlign" Wrap="False">44</asp:TextBox>
</asp:TableHeaderCell>
<asp:TableHeaderCell Width="33%" HorizontalAlign = "Right">
<asp:TextBox ID="txtboxCol2Row2" runat="server" BorderStyle="None"
CssClass="valuesAlign" Wrap="False">55</asp:TextBox>
</asp:TableHeaderCell>
<asp:TableHeaderCell Width="33%" HorizontalAlign = "Right">
<asp:TextBox ID="txtboxCol3Row2" runat="server" BorderStyle="None"
CssClass="valuesAlign" Wrap="False">66</asp:TextBox>
</asp:TableHeaderCell>
</asp:TableRow>
</asp:table>