Mano Prathibhan C Mano Prathibhan C - 1 month ago 9
ASP.NET (C#) Question

Horizontal align of many Buttons in UL in ASP.NET

I have created a list of buttons using

ul
as given below in the code,



#div_buttons ul {
padding: 0;
margin: 0;
list-style: none;
list-style-type: none;
display: inline-block;
}

#div_buttons ul input {
text-decoration: none;
}

<div id="div_buttons">
<ul>
<li><input type="button" ID="button_1" value="Button 1" /></li><br />
<li><input type="button" ID="button_2" value="Button 2" /></li><br />
<li><input type="button" ID="button_3" value="Button 3" /></li><br />
</ul>
</div>





Here i want to arrange them and display the buttons as horizontal list instead of vertical..how can i do that? Actually i want to do this in ASP.NET
<asp:Button>
instead of
<input type="submit">
but since the snippet here doesn't support ASP.NET i displayed in
HTML
. Im not sure what CSS to add to arrange the UL in horizontal way.

Answer

Answer given above is perfectly right.But it uses CSS.

I found a simple solution to your answer that little bit different and also inconvenient. But i am writing just for your knowledge purpose.

If you know word named

 nbsp;

that is used for spacing between two tags. So you can use one li tag and make 3 button inside it(1 li tag only). But use & before nbsp; between two input tags.

<li>
      <input type="button" ID="button_1" value="Button 1" /> &nbsp; 
      <input type="button" ID="button_2" value="Button 2" /> &nbsp; 
      <input type="button" ID="button_3" value="Button 3" /> &nbsp; 
</li>
Comments