HawkB
HawkB

Reputation: 181

align button with input in bootstrap 3

I need to align the button with the inputs fields.

<link href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css" rel="stylesheet"/>
<form>
   <div class="form-group col-lg-6">
      <label for="email">Nome:</label>
      <input type="email" class="form-control" id="email">
   </div>
   <div class="form-group col-lg-6">
      <label for="pwd">CNPJ:</label>
      <input type="password" class="form-control" id="pwd">
   </div>
   <div class="input-group-btn">
      <button type="submit" class="btn btn-default">Submit</button>    
   </div>
</form>

Any idea? Thanks.

Upvotes: 1

Views: 610

Answers (1)

Shady Alset
Shady Alset

Reputation: 5714

Just add the class col-lg-6 to button div:

<div class="input-group-btn col-lg-6">
    <button type="submit" class="btn btn-default">Submit</button>    
</div>

<link href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css" rel="stylesheet"/>
<form>
   <div class="form-group col-lg-6">
      <label for="email">Nome:</label>
      <input type="email" class="form-control" id="email">
   </div>
   <div class="form-group col-lg-6">
      <label for="pwd">CNPJ:</label>
      <input type="password" class="form-control" id="pwd">
   </div>
   <div class="input-group-btn col-lg-6">
      <button type="submit" class="btn btn-default">Submit</button>    
   </div>
</form>

Upvotes: 1

Related Questions