0

I have problem adding spaces between CheckBoxes and text next to them. I want to have them intended a little bit, not next to each other without some space.

▓car▓wash▓next and have it like ▓ car ▓ wash ▓ next

CheckBoxes aren't fixed at size, they are gathered from database.

I have CheckBoxList like:

<asp:CheckBoxList ID="chBoxListManufacturer" runat="server" BackColor="LightBlue" BorderColor="Red" CellPadding="5" CssClas="mycheckbox"
       TextAlign="Right" RepeatDirection="Horizontal" RepeatLayout="Flow" OnSelectedIndexChanged="BoxListManufacturer_OnSelectedIndexChanged" AutoPostBack="True" />

Css:.mycheckbox {margin-right: 15px;}

I was reading docs, but nothing works.

Július Marko
  • 1,196
  • 5
  • 15
  • 37
  • Use browser developer tool (Inspect Element) and identify HTML of checkboxlist. Apply CSS use margin to put space between controls. – Suprabhat Biswal Jul 06 '17 at 07:14
  • This answer can be of help to you: [https://stackoverflow.com/questions/1681425/alignment-and-padding-for-aspcheckboxlist](https://stackoverflow.com/questions/1681425/alignment-and-padding-for-aspcheckboxlist) – Rinos Jul 06 '17 at 07:14

2 Answers2

0

you can try with css class:

your checkboxlist here.

<asp:CheckBoxList ID="CheckBoxList1" runat="server" CssClass="test">
        <asp:ListItem Text="Yes" Value="Yes" Selected="True"></asp:ListItem>
        <asp:ListItem Text="No" Value="No"></asp:ListItem>
    </asp:CheckBoxList>

css here.

.test td
{
    border:1px solid red;
    margin-right:10px;
    padding-right:20px;
}

output. My output using same code

Preet
  • 984
  • 2
  • 14
  • 34
  • I made it like you, but it seems like css is not reloading. If I set for instance background color to red, nothing changes. I updated my Code above like it looks now. – Július Marko Jul 06 '17 at 07:21
  • @Julius Marko i have edited the code and now its working i tested on my vs. In your case you only need padding-right. Plz let me know if it worked for you as well. Thanks – Preet Jul 06 '17 at 07:34
  • Not working. I think there is something that I'm not paying attention to. Looks like css don't change anything. – Július Marko Jul 06 '17 at 07:41
  • make sure you using – Preet Jul 06 '17 at 07:45
  • I have CSS in my stylesheet file – Július Marko Jul 06 '17 at 07:47
0

Maybe a trivial answer: put a &nbsp; after each checkbox, this will allow you some space between the control and the following label

Stefano Losi
  • 719
  • 7
  • 18