2016-09-20 586 views
0

我有我正在使用的表格中的checkboxlist。我需要与第二栏中的复选框对齐。每行文本框(第二行)的间距为26px。我找不到如何在复选框列表中的项目之间进行间距。仅设置边距时,列表的外部不是其中的项目。如何在复选框列表项之间添加间距?

enter image description here

enter image description here

我试图CELLSPACING,但我不能让它相当一字排开。

更新2

<td style="vertical-align: top" rowspan="7" Width="175" style="padding: 0;"> 
       <asp:CheckBoxList ID="cbtasklist" runat="server" CssClass="radiobutton"> 
        <asp:ListItem Value="Task 1">Task 1</asp:ListItem> 
        <asp:ListItem Value="Task 2">Task 2</asp:ListItem> 
        <asp:ListItem Value="Task 3">Task 3</asp:ListItem> 
        <asp:ListItem>Task 4</asp:ListItem> 
        <asp:ListItem Value="Task 5">Task 5</asp:ListItem> 
        <asp:ListItem Value="Other1">Other</asp:ListItem> 
        <asp:ListItem Value="Other2">Other</asp:ListItem> 
       </asp:CheckBoxList> 


        </td> 
       <td class="auto-style187" style="vertical-align: top" colspan="2"> 

        &nbsp;</td> 


.auto-style187 { 
     height: 26px; 
     width: 357px; 
    } 

更新3: 难道是容易的每一行做一个复选框,这样我就可以使用相同的CSS的另一列?

的原因复选框列表是用于验证一个1必须被选择。

+0

您是否尝试过的CheckBoxList.CellSpacing财产? https://msdn.microsoft.com/en-us/library/system.web.ui.webcontrols.checkboxlist.cellspacing(v=vs.110).aspx – sr28

回答

0

我希望你正在寻找这个

<form id="form1" runat="server"> 
<div style="width: 100%"> 



    <table class="auto-style1"> 
     <tr> 
      <td class="auto-style3"> 
       <asp:CheckBoxList ID="CheckBoxList1" runat="server" Height="163px"> 
        <asp:ListItem>a</asp:ListItem> 
        <asp:ListItem>b</asp:ListItem> 
        <asp:ListItem>c</asp:ListItem> 
        <asp:ListItem>d</asp:ListItem> 
        <asp:ListItem>e</asp:ListItem> 
        <asp:ListItem>f</asp:ListItem> 
       </asp:CheckBoxList> 
      </td> 
      <td class="auto-style8"> 
       <table class="auto-style1"> 
        <tr> 
         <td class="auto-style5"> 
          <asp:TextBox ID="TextBox1" runat="server" OnTextChanged="TextBox1_TextChanged"></asp:TextBox> 
         </td> 
         <td>aaaa</td> 
        </tr> 
        <tr> 
         <td class="auto-style6"> 
          <asp:TextBox ID="TextBox2" runat="server"></asp:TextBox> 
         </td> 
         <td class="auto-style7">aaaa</td> 
        </tr> 
        <tr> 
         <td class="auto-style5"> 
          <asp:TextBox ID="TextBox3" runat="server"></asp:TextBox> 
         </td> 
         <td>aaaa</td> 
        </tr> 
        <tr> 
         <td class="auto-style10"> 
          <asp:TextBox ID="TextBox4" runat="server"></asp:TextBox> 
         </td> 
         <td class="auto-style11">aaaa</td> 
        </tr> 
        <tr> 
         <td class="auto-style12"> 
          <asp:TextBox ID="TextBox5" runat="server"></asp:TextBox> 
         </td> 
         <td class="auto-style13">aaaa</td> 
        </tr> 
        <tr> 
         <td class="auto-style5"> 
          <asp:TextBox ID="TextBox6" runat="server" OnTextChanged="TextBox6_TextChanged"></asp:TextBox> 
         </td> 
         <td>aaaa</td> 
        </tr> 
       </table> 
      </td> 
      <td class="auto-style4"></td> 
     </tr> 
     <tr> 
      <td class="auto-style2">&nbsp;</td> 
      <td class="auto-style9">&nbsp;</td> 
      <td>&nbsp;</td> 
     </tr> 
     <tr> 
      <td class="auto-style2">&nbsp;</td> 
      <td class="auto-style9">&nbsp;</td> 
      <td>&nbsp;</td> 
     </tr> 
     <tr> 
      <td class="auto-style14"></td> 
      <td class="auto-style15"></td> 
      <td class="auto-style11"></td> 
     </tr> 
     <tr> 
      <td class="auto-style2">&nbsp;</td> 
      <td class="auto-style9">&nbsp;</td> 
      <td>&nbsp;</td> 
     </tr> 
    </table> 



    </div> 

    </form> 

看到图像

updated one

我只是把一个表内表。你可以只删除不需要列你的愿望

不要忘了编辑的文本框中阵容它您

+0

可悲的是,没有奏效。看到更新 – scubieman

+0

检查这个新的希望这个诡计将帮助你 –

+0

文本稍微偏离他们想要完美列队的文本框。 – scubieman

0

你为什么不跟这个尝试在你的CSS:

checkbox { padding-bottom: 10px; }