Bootstrap Input Group
Bootstrap input groups offer a flexible and powerful way to add add-ons, buttons, and forms to your inputs. This page will guide you through the necessary syntax, examples, and explanations to help you create input groups in Bootstrap.
Syntax
To create a Bootstrap input group, you can either wrap an input and an add-on together or use the .input-group
class to wrap both elements. Here is an example of how to create an input and an add-on together:
<div class="input-group mb-3">
<input type="text" class="form-control" placeholder="Recipient's username" aria-label="Recipient's username" aria-describedby="basic-addon2">
<div class="input-group-append">
<span class="input-group-text" id="basic-addon2">@example.com</span>
</div>
</div>
And here is an example of how to use the .input-group
class instead:
<div class="input-group mb-3">
<div class="input-group-prepend">
<span class="input-group-text" id="basic-addon1">@</span>
</div>
<input type="text" class="form-control" placeholder="Username" aria-label="Username" aria-describedby="basic-addon1">
</div>