日期:2014-05-18  浏览次数:20467 次

一个Label布局的问题
有一个Label放在一个表格中,但是我每次把它居右显示后,一运行,它就跑回左边,不会在右边,真是怪
C# code
            <td style="width: 100px; text-align: right; vertical-align: top;">
                <br />
                <asp:Label ID="Label3" runat="server" Font-Size="Small" Height="12px" Text="2008-88-88 88:88:88"
                    Width="158px"></asp:Label></td>


------解决方案--------------------
把有关Table和Tr的代码也贴出来啊
------解决方案--------------------
可能是因为你Label的宽度超过了td的宽度吧,
修改后如下:
<table >
<tr>
<td style="width: 100px; height: 32px;">
<asp:Label ID="Label1" runat="server" Font-Bold="True" Font-Size="X-Large" Height="30px"
Text="Label" Width="606px"></asp:Label></td>
</tr>
<tr>
<td >
<br />
<asp:Label ID="Label2" runat="server" Text="Label" Width="604px"></asp:Label><br />
</td>
</tr>
<tr>
<td style=" text-align: right; height: 36px;">
<br />
<asp:Label ID="Label3" runat="server" Font-Size="Small" Height="12px" Text="2008-88-88 88:88:88"
Width="158px"></asp:Label></td>
</tr>
</table>
------解决方案--------------------
建议把<br/>去掉
------解决方案--------------------
这样就可以了吧
------解决方案--------------------
Insus.NET把你的code帖过来run时,
Label1和Label2是居左;
Label3是居右!