我有以下设计:
代码:
<table width="70%" align="center" class ="TableBorder">
<tr>
<td colspan="2" class="Heading" align="center">
Add Client
</td>
</tr>
<tr>
<td class="NormalText" align="right">
Client Name:
</td>
<td align="left">
<asp:TextBox ID="txtClientName" runat="server" CssClass="ThinTextBox"></asp:TextBox>
<asp:Label ID="lblAgentName0" runat="server" ForeColor="#FF3300" Text="*"></asp:Label>
</td>
</tr>
<tr>
<td class="NormalText" width="40%" align="right">
Client Login Email ID:
</td>
<td align="left">
<asp:TextBox ID="txtClientID" runat="server" CssClass="ThinTextBox"></asp:TextBox>
<asp:Label ID="lblAgentName1" runat="server" ForeColor="#FF3300" Text="*"></asp:Label>
</td>
</tr>
<tr>
<td class="NormalText" align="right">
Client Password:
</td>
<td align="left">
<asp:TextBox ID="txtClientPwd" runat="server" CssClass="ThinTextBox"></asp:TextBox>
<asp:Label ID="lblAgentName2" runat="server" ForeColor="#FF3300" Text="*"></asp:Label>
</td>
</tr>
<tr>
<td align="right" class="NormalText">
Contact No.:</td>
<td align="left">
<asp:TextBox ID="txtContactNo" runat="server" CssClass="ThinTextBox"></asp:TextBox>
<asp:Label ID="lblAgentName3" runat="server" ForeColor="#FF3300" Text="*"></asp:Label>
</td>
</tr>
<tr>
<td align="right" class="NormalText" valign="top" >
Address:</td>
<td align="left">
<asp:TextBox ID="txtAddress" runat="server" CssClass="ThinTextBox"
Height="100px" TextMode="MultiLine" Width="200px"></asp:TextBox>
<asp:Label ID="lblAgentName4" runat="server" ForeColor="#FF3300" Text="*"></asp:Label>
</td>
</tr>
<tr>
<td align="right" class="NormalText" width="30%">
</td>
<td align="left">
<asp:Button ID="btnSave" runat="server" CssClass="ButtonColor" Text="Save" />
<asp:Button ID="btnCancel" runat="server" CssClass="ButtonColor"
Text="Cancel" />
</td>
</tr>
</table>
我只想删除地址文本框标记区域与&#34; *&#34;之间的间距。标签
我试图将财产作为valign =&#34; top&#34;标签,但它不接受它。
请帮帮我。
答案 0 :(得分:2)
试试这个
将 style =“vertical-align:top;”添加到标签
<asp:Label ID="lblAgentName4" runat="server" ForeColor="#FF3300" Text="*" style="vertical-align:top;"></asp:Label>
答案 1 :(得分:1)
试试这个,
<table width="70%" align="center" class="TableBorder">
<tr>
<td colspan="3" class="Heading" align="center">
Add Client
</td>
</tr>
<tr>
<td class="NormalText" align="right">
Client Name:
</td>
<td align="left" colspan="2">
<asp:TextBox ID="txtClientName" runat="server" CssClass="ThinTextBox"></asp:TextBox>
<asp:Label ID="lblAgentName0" runat="server" ForeColor="#FF3300" Text="*"></asp:Label>
</td>
</tr>
<tr>
<td class="NormalText" width="40%" align="right">
Client Login Email ID:
</td>
<td align="left" colspan="2">
<asp:TextBox ID="txtClientID" runat="server" CssClass="ThinTextBox"></asp:TextBox>
<asp:Label ID="lblAgentName1" runat="server" ForeColor="#FF3300" Text="*"></asp:Label>
</td>
</tr>
<tr>
<td class="NormalText" align="right">
Client Password:
</td>
<td align="left" colspan="2">
<asp:TextBox ID="txtClientPwd" runat="server" CssClass="ThinTextBox"></asp:TextBox>
<asp:Label ID="lblAgentName2" runat="server" ForeColor="#FF3300" Text="*"></asp:Label>
</td>
</tr>
<tr>
<td align="right" class="NormalText">
Contact No.:
</td>
<td align="left" colspan="2">
<asp:TextBox ID="txtContactNo" runat="server" CssClass="ThinTextBox"></asp:TextBox>
<asp:Label ID="lblAgentName3" runat="server" ForeColor="#FF3300" Text="*"></asp:Label>
</td>
</tr>
<tr>
<td align="right" class="NormalText" valign="top">
Address:
</td>
<td align="left" class="style1" valign="top">
<asp:TextBox ID="txtAddress" runat="server" CssClass="ThinTextBox" Height="100px"
TextMode="MultiLine" Width="200px"></asp:TextBox>
</td>
<td align="left" valign="top">
<asp:Label ID="lblAgentName4" runat="server" ForeColor="#FF3300" Text="*"></asp:Label>
</td>
</tr>
<tr>
<td align="right" class="NormalText" width="30%">
</td>
<td align="left" colspan="2">
<asp:Button ID="btnSave" runat="server" CssClass="ButtonColor" Text="Save" />
<asp:Button ID="btnCancel" runat="server" CssClass="ButtonColor" Text="Cancel" />
</td>
</tr>
</table>
答案 2 :(得分:1)
你必须在你的css中使用文字 vertical-align:text-top; 这样的td:
<td align="left" style="vertical-align: text-top;">
<asp:TextBox ID="txtAddress" runat="server" CssClass="ThinTextBox"
Height="100px" TextMode="MultiLine" Width="200px"></asp:TextBox>
<asp:Label ID="lblAgentName4" runat="server" ForeColor="#FF3300" Text="*"></asp:Label>
</td>
因为你的asp将你的Label控件渲染为html span 元素,而对于spans需要text-top style /