Arif YILMAZ
Arif YILMAZ

Reputation: 5866

dropdownlist and text arent on the same level

I have dropdownlist and text doesnt display on the same level. text is located upper and dropdownlist is located on lower.

here is my code

<div style="display:inline;float:left">Ödeme Kalemi:</div>
   <div style="display:inline;float:left">
      <asp:DropDownList ID="DropDownList1" runat="server">
          <asp:ListItem>test</asp:ListItem>
          <asp:ListItem>test2</asp:ListItem>
      </asp:DropDownList>
   </div>
<div style="clear:both"></div>

and here is the screenshot

enter image description here

Please help me fix this. I need to align them horizontally.

Upvotes: 0

Views: 971

Answers (1)

Win
Win

Reputation: 62260

You can use the following css to display dropdownlist next to label.

enter image description here

<style type="text/css">
    .row { clear: both; overflow: hidden; padding: 5px 0; width: 100%; }
    .row label { float: left; text-align: right; 
        margin-right: 10px; width: 150px; }
    .row .value { float: left; text-align: left; }
</style>

<div class="row">
    <label>Ödeme Kalemi:</label>
    <div class="value">
        <asp:DropDownList ID="DropDownList1" runat="server">
            <asp:ListItem>test</asp:ListItem>
            <asp:ListItem>test2</asp:ListItem>
        </asp:DropDownList>
    </div>
</div>

Upvotes: 1

Related Questions