Reputation: 99
I would like to display, label and inputs on same line :
I tried in CSS:
form label {
display:block;
float:left;
}
Upvotes: 3
Views: 18708
Reputation: 22331
If you are using Bootstrap 3.x:
<form class="form-horizontal" role="form">
<div class="form-group">
<label for="inputType" class="col-sm-2 control-label">Label</label>
<div class="col-sm-4">
<input type="text" class="form-control" id="inputCity" placeholder="Input text">
</div>
</div>
</form>
Upvotes: 1
Reputation: 3213
here it is
.span6{
overflow:hidden;
display:inline;
}
.span6 label, .span6 input {
display:inline-block;
}
.span6 input {
width:70%;
margin-left:3%;
}
Upvotes: 4
Reputation: 516
I did this in my script. I created a div container box and inside the container, a label left to an input element.
. HTML
<div class="container">
<label>Firstname</label>
<input type="text">
</div>
CSS
div.container{
overflow:hidden;
}
label{
width:70px;
display:block;
float:left;
text-align:left;
}
input{
width:240px;
float:left;
}
Upvotes: 0