2015-09-07 194 views
0
<table> 
     <tr> 
      <td> 
       <asp:Label Text="Team :" runat="server"></asp:Label></td> 
      <td> 
       <asp:DropDownList ID="ddlProject" OnSelectedIndexChanged="itemSelected" AutoPostBack="True" runat="server"></asp:DropDownList></td> 
     </tr> 
     <tr> 
      <td> 
       <asp:Label Text="Project :" runat="server"></asp:Label></td> 
      <td> 
       <asp:DropDownList ID="ddlDetails" runat="server"></asp:DropDownList></td> 
     </tr> 
     <tr> 
      <td> 
       <asp:Button ID="btnBugSubmit" Text="Bug" OnClick="btnBugSubmit_Click" runat="server"/></td> 
      <td> 
       <asp:Button ID="btnIssueSubmit" Text="Issue" OnClick="btnIssueSubmit_Click" runat="server"/></td> 
      <td > 
       <asp:Button ID="btnReqSubmit" Text="Requisition" OnClick="btnReqSubmit_Click" runat="server"/></td> 
     </tr> 
    </table> 

其中一個按鈕「btnReqsubmit」(下面圈出)未對齊,我不知道爲什麼。 我的代碼有什麼問題嗎?表中的asp.net按鈕未對齊

enter image description here

+0

能否請您創建_complete_和_relevant_代碼 – Tushar

+0

一個可能的快速技巧來解決這個jsfiddle.net演示;從最後一個tr中移除所有三個td,並指定一個帶colspan = 3的td,並將​​所有按鈕都包含在內。 –

回答

0

可能的解決方案。理想情況下,每行應該有相同數量的td
在您的第一個tr中,您只有2個td,而在另一箇中您有3個td

您可以visit here看到合併單元格屬性

<table> 
     <tr> 
      <td> 
       <asp:Label Text="Team :" runat="server"></asp:Label> 
      </td> 
      <td colspan="2"> 
       <asp:DropDownList ID="ddlProject" OnSelectedIndexChanged="itemSelected" 
        AutoPostBack="True" runat="server"></asp:DropDownList> 
      </td> 
     </tr> 
     <tr> 
      <td> 
       <asp:Label Text="Project :" runat="server"></asp:Label> 
      </td> 
      <td colspan="2"> 
       <asp:DropDownList ID="ddlDetails" runat="server"> 
       </asp:DropDownList> 
      </td> 
     </tr> 
     <tr> 
      <td> 
       <asp:Button ID="btnBugSubmit" Text="Bug" 
        OnClick="btnBugSubmit_Click" runat="server"/> 
      </td> 
      <td> 
       <asp:Button ID="btnIssueSubmit" Text="Issue" 
       OnClick="btnIssueSubmit_Click" runat="server"/> 
      </td> 
      <td > 
       <asp:Button ID="btnReqSubmit" Text="Requisition" 
       OnClick="btnReqSubmit_Click" runat="server"/> 
      </td> 
     </tr> 
    </table> 
0

此問題是因爲第二線project下拉寬度的情況是更

如果您使用的表結構這個問題會

因爲列的寬度將被調整到列中單元的最大寬度

使用divspan代替

看到下面的演示

input[type="button"] { 
 
    margin:5px; 
 
    width:50px; 
 
} 
 

 
label { 
 
    border:none 
 
    width:10px; 
 
} 
 
select { 
 
    width:100px; 
 
}
<div> 
 
     <div> 
 
      <span> 
 
       <label>Text</label></span> 
 
      <span> 
 
       <select></select></span> 
 
     </div> 
 
     <div> 
 
      <span> 
 
       <label>Text</label></span> 
 
      <span> 
 
       <select></select></span> 
 
     </div> 
 
     <div> 
 
      <span> 
 
       <input type="button"/></span> 
 
      <span> 
 
       <input type="button"/></span> 
 
      <span> 
 
       <input type="button"/></span> 
 
     </div> 
 
    </div>

0

你已經創建了2個細胞前兩行和3最後一排,所以

替換最後tr與下面的代碼

<tr> 
      <td> 
       <asp:Button ID="btnBugSubmit" Text="Bug" OnClick="btnBugSubmit_Click" runat="server"/></td> 
      <td> 
       <asp:Button ID="btnIssueSubmit" Text="Issue" OnClick="btnIssueSubmit_Click" runat="server"/> 

       <asp:Button ID="btnReqSubmit" Text="Requisition" OnClick="btnReqSubmit_Click" runat="server"/></td> 
     </tr>