Reputation: 2499
I have a DIV element:
<div style="background-color:red">This is a test
<label>ID:</label>
<asp:TextBox runat="server"><asp:Textbox>
</div>
I need to show "This is a test" on left side but the Label and Textbox on the right side of the side.
I tried
margin:right 0px;
but this did not help.
Also tried Float:right but this created strange results.
Upvotes: 4
Views: 8807
Reputation: 3626
Add a div to wrap the label and input, and use float
:
.input-group {
float: right;
}
<div style="background-color:red">This is a test
<div class="input-group">
<label>ID:</label>
<input type="text" />
</div>
</div>
Upvotes: 3
Reputation: 171
You can try using float:right;
in your style:
<div style="background-color:red">This is a test
<div style="float:right">
<label>ID:</label>
<asp:TextBox runat="server"><asp:Textbox>
</div>
</div>
Upvotes: 0