I need to reduce the vertical spacing between the

I need to reduce the vertical spacing between the <asp:ListItem>. I tried giving style=”margin-bottom=5px and margin-top: 5px;” but it is not working. how to do it?

<asp:RadioButtonList ID="rblGlobalConfidential" runat="server" 
     RepeatDirection="Vertical"  AutoPostBack="false"
     onChange="ConfidentialTypeChange();" Font-Bold="true" Font-Size="Medium">
    <asp:ListItem>None</asp:ListItem>
    <asp:ListItem>Coding Restriction Based</asp:ListItem>
    <asp:ListItem>Transaction Type & Vendor Based</asp:ListItem>
</asp:RadioButtonList>

I tried using

style="margin-bottom=5px;"

style="margin-top: 5px;"

style="height:5px;"  

and other options, but it is not working. How to do it?

  • Questions seeking code help must include the shortest code necessary to reproduce it in the question itself preferably in a Stack Snippet using the <> icon. See How to create a Minimal, Reproducible Example

    – 

You must have some other stray css in effect.

However, try this:

        <style>
            .myspacing label,input {
               margin-bottom:-2px;
               margin-top:-2px;
               font-size:medium;     
            }
            .myspacing input {
                margin-right:10px;
            }
        </style>

        <asp:RadioButtonList ID="rblGlobalConfidential" runat="server"
            RepeatDirection="Vertical" AutoPostBack="false"
            CssClass="myspacing" >
            <asp:ListItem>None</asp:ListItem>
            <asp:ListItem>Coding Restriction Based</asp:ListItem>
            <asp:ListItem>Transaction Type & Vendor Based</asp:ListItem>
        </asp:RadioButtonList>

Above shows and renders as this:

enter image description here

I don’t think you can have any “less” spacing between each line then above unless you start using a smaller font.

<asp:ListItem runat="server">None</asp:ListItem>
<asp:ListItem runat="server" style="float:left; margin-top: -10px;">Coding Restriction Based</asp:ListItem>
<asp:ListItem runat="server" style="float:left; margin-top: -10px;">Transaction Type & Vendor Based</asp:ListItem>

These changes got me the fixes I want

Leave a Comment