Search code examples
htmlasp.netdhtml

The label is falling down in the list tag


<li><span>Test:</span>
<asp:Label style="float:right;padding-right:5px"
           runat="server"
           ID="lblTest">
</asp:Label></li>

I have a span and a label(I am aware its also rendered as span), somehow the static span's text is fine but the label's text falls down in the Li element....down to the bottom. I have tried vertical align and text align, top:0, but no luck to have them in a straight line


Solution

  • <li>
        <span>Test:</span>
        <asp:Label style="display:inline-block;" runat="server" ID="lblTest">hi</asp:Label>
    </li>
    

    Change your style to this:

    style="display:inline-block;"
    

    It displays the block as below

    Output

    Working Fiddle