Reputation: 3616
I'm trying to put some input elements (~7) in the same line.
I have the following code:
<form>
<b> One </b>
<input type="number" style = "width: 5%; vertical-align:top" class="form-control" name="quantity" value="1" >
</form>
<form>
<b> Two </b>
<input type="number" style = "width: 5%; vertical-align:top" class="form-control" name="quantity" value="1" >
</form>
<form>
<b> Three</b>
<input type="number" style = "width: 5%; vertical-align:top" class="form-control" name="quantity" value="1" >
</form>
The problem is that every input every input has it own line, and it not in the same line.
Edit: Also, I wish that it will be with space in that way that the inputs elements would comprehend the whole line. Hoe can I do it?
Upvotes: 0
Views: 97
Reputation: 3089
Set every form tag to 'display: inline;'
In that html file:
<style>
form {
display: inline;
}
</style>
OR in your css file:
form {
display: inline;
}
OR each tag :
<form style="display: inline;">
Upvotes: 0
Reputation: 308
Your input elements should all share the same form, and your styling can be modified & put into CSS, which will simplify your code significantly.
Here's a working example:
HTML
<form>
<input type="number" />
<input type="number" />
<input type="number" />
</form>
CSS
input {
display: inline;
width: 5%;
vertical-align:top;
}
Upvotes: 0
Reputation: 8256
Change the display, remove the inline styles. Example: http://jsfiddle.net/ys1Lgj7e/
form {
display:inline-block;
}
Upvotes: 1