I'm using bootstrap and I have placed my inputs within their own .form-group
. All my inputs are also contained within a div with a .well
class.
I want to remove the default margin-bottom:15px
that bootstrap has for .form-group
but only if its the last instance of .form-group
within its parent .well
div.
<div class="well">
<div class="form-group">
<div class="col-md-6">
<div class="form-group">
<label class="m-b-none">Name</label>
<div class="input-group">
<input class="form-control" name="Name">
<div class="input-group-addon"><i class="fa fa-check-circle"></i></div>
</div>
</div>
<div class="form-group">
<label class="m-b-none">Surname</label>
<div class="input-group">
<input class="form-control" name="Surname">
<div class="input-group-addon"><i class="fa fa-check-circle"></i></div>
</div>
</div>
</div>
</div>
So I want to remove set the margin-bottom
to 0px on the last form-group
within each of the elements with the class well
.
I tried the below code but it just applied the style to all .form-groups
.well .form-group:last-of-type {
margin-bottom: 0!important;
}
.well .form-group:last-of-type {
margin-bottom: 0 !important;
}
<link href="https://stackpath.bootstrapcdn.com/bootstrap/4.1.3/css/bootstrap.min.css" rel="stylesheet" />
<div class="well">
<div class="form-group">
<input/>
</div>
<div class="form-group">
<input/>
</div>
</div>
<div class="well">
<div class="form-group">
<input/>
</div>
<div class="form-group">
<input/>
</div>
</div>