Home > Blockchain >  How do I add a space between a RadioButtonList's radio buttons and their text?
How do I add a space between a RadioButtonList's radio buttons and their text?

Time:02-10

I have been reading about some workaround but haven't found anything that works for me. I'm using Bootstrap in my ASPX page to display a RadioButtonList with "Yes" and "No" options like so:

<div >
    <label  style="margin-top: 0px; margin-right: 15px; margin-bottom: 0px;">I worked in person:</label>
    <asp:RadioButtonList runat="server" ID="input_inPerson">
        <asp:ListItem Selected="False" Value="true">Yes</asp:ListItem>
        <asp:ListItem Selected="False" Value="false">No</asp:ListItem>
    </asp:RadioButtonList>
</div>

The button and text are not spaced at all, as shown here:

Poorly spaced button and text

My question is, are there any ways to add a space between this button and the text? If so, can I use bootstrap's "m" classes to do it?

CodePudding user response:

Just toss in a style, as the "label" part of the radio buttons are rendered as a simple "label"

So, try this:

        <style>
            .butLabel label {margin-left:15px} 
        </style>

    <div >
        <label  style="margin-top: 0px; margin-right: 15px; margin-bottom: 0px;">I worked in person:</label>
        <asp:RadioButtonList runat="server" ID="input_inPerson" CssClass="butLabel">
            <asp:ListItem Selected="False" Value="true">Yes</asp:ListItem>
            <asp:ListItem Selected="False" Value="false">No</asp:ListItem>
        </asp:RadioButtonList>
    </div>

So, with say 15px, you get this:

enter image description here

  • Related