Reputation: 347
I would like to put 2 forms in a web page, but one under the other. Like this:
<body id="Signup">
<form class="row col-lg-6">
<legend>Légende</legend>
<div class="form-group">
<label for="text">Text : </label>
<input id="text" type="text" class="form-control">
</div>
<div class="form-group">
<label for="textarea">Textarea : </label>
<textarea id="textarea" type="textarea" class="form-control"></textarea>
</div>
<div class="form-group">
<label for="select">Select : </label>
<select id="select" class="form-control">
<option>Option 1</option>
<option>Option 2</option>
<option>Option 3</option>
</select>
</div>
<br>
<button>Envoyer</button>
</form>
<form class="row">formulaire</form>
</body>
As you can see both forms are using the .row
class, but the are still inline when displaying the page.
I don't see what I am missing here.
Upvotes: 0
Views: 868
Reputation: 2188
You should make structure like this:
<body id="Signup" class="row">//"row" should be a parent to columns
<form class="col-lg-12"> //width:100% or col-lg-6 for width: 50%
...
</form>
<form class="col-lg-12">formulaire</form>
Upvotes: 0
Reputation: 12400
What you're doing is a little strange. Your best option is to create div rows and columns. Then inside of the divs define your forms. However, the real issue here is that you applied both row and column classes to the first form:
<form class="row col-lg-6">
You can't do that, row and column must be defined separately:
<div class="row">
<div class="col-lg-6">
</div>
</div>
Upvotes: 1
Reputation: 60563
you are using .col-lg-6
along with .row
should be child, and then use col-*-12
to have full width
also, you are missing .container
as parent.
<link href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css" rel="stylesheet" />
<div class="container">
<form class="row">
<div class="col-xs-12">
<legend>Légende</legend>
<div class="form-group">
<label for="text">Text :</label>
<input id="text" type="text" class="form-control">
</div>
<div class="form-group">
<label for="textarea">Textarea :</label>
<textarea id="textarea" type="textarea" class="form-control"></textarea>
</div>
<div class="form-group">
<label for="select">Select :</label>
<select id="select" class="form-control">
<option>Option 1</option>
<option>Option 2</option>
<option>Option 3</option>
</select>
</div>
<br>
<button>Envoyer</button>
</div>
</form>
<form class="row">
<div class="col-xs-12">formulaire</div>
</form>
</div>
Upvotes: 3
Reputation: 15407
Replace the row col-lg-6
class from <form class="row col-lg-6">
with col-lg-12
Upvotes: 0