In Bootstrap, how can I get a button group like the following that span the full width of a parent element? (like with the ".btn-block" class, but applied to a group http://getbootstrap.com/css/#buttons-sizes )
<div class="btn-group" role="group" aria-label="...">
<button type="button" class="btn btn-default">Left</button>
<button type="button" class="btn btn-default">Middle</button>
<button type="button" class="btn btn-default">Right</button>
</div>
In Bootstrap 4, make use of
.d-flex
on your.btn-group
and.w-100
on individual buttons:Flexbox can do that.
Correct solution for Bootstrap 4 (from its migration documentation):
Example:
Source: https://getbootstrap.com/docs/4.0/migration/#button-group
You can also use
.btn-group-justified
.You can also use bootstraps
btn-block
will span across parent.Create block level buttons—those that span the full width of a parent—by adding .
btn-block
.https://getbootstrap.com/docs/4.0/components/buttons/