Reputation: 3644
I have the following HTML:
<div class="onerow">
Site ID: <input type="text" name="siteId" id="siteId" class="k-textbox" data-bind="value: siteId"/>
</div>
<div class="onerow">
<div id="select">
<label for="state">View:</label>
<select id="state" data-role="dropdownlist" data-bind="value: state" data-option-label="Select State">
<option value="2">All</option>
<option value="1">Active</option>
<option value="3">All except deleted</option>
</select>
<input type="button" id="buttonsearch" value="Search" class="k-button" data-bind="events: {click: onSearchClick}"/>
</div>
</div>
Or, in jsFiddle: http://jsfiddle.net/j7ksuv9y/
I want to position both of those on the same row, one after the other. I've tried using style="float: right"
but that only ends up placing the second input box to the far right of the screen, which is not what I want.
How might I accomplish this?
Upvotes: 0
Views: 13401
Reputation: 169
There are 2 ways by which this can be achieved :-
1) One option as already mentioned above is by setting css to the class of the outer div as display:inline as mentioned
2)
<div class="onerow">
<label class="lbl">Site ID: </label>
<input type="text" name="siteId" id="siteId" class="k-textbox" data-bind="value: siteId"/>
<div class="clear" style="clear:both;"></div>
</div>
is by adding the below css :-
.lbl, .k-textbox
{float:left}
In this clear both is mentioned so that it supports IE as well. This will work on all browsers and give the output as required.
Upvotes: 1
Reputation: 1297
You can try this:
<div class="onerow">
Site ID: <input type="text" name="siteId" id="siteId" class="k-textbox" data-bind="value: siteId"/>
<label for="state">View:</label>
<select id="state" data-role="dropdownlist" data-bind="value: state" data-option-label="Select State">
<option value="2">All</option>
<option value="1">Active</option>
<option value="3">All except deleted</option>
</select>
<input type="button" id="buttonsearch" value="Search" class="k-button" data-bind="events: {click: onSearchClick}"/>
</div>
Upvotes: 0
Reputation: 3047
Add the following css :
.onerow {
display: inline-block;
}
This will make the element display inline but also as a block.
Quote from MDN
The element generates a block element box that will be flowed with surrounding content as if it were a single inline box (behaving much like a replaced element would)
Upvotes: 2