Input groups
Attach text or buttons to the side of an input:
<div class="input-group">
<span class="input-group-text">₹</span>
<input type="number" class="form-control">
<span class="input-group-text">.00</span>
</div>
Uses: currency signs, @ for usernames, +91 for phone numbers, a Search button, or a show/hide password button. Sizes: input-group-lg, input-group-sm.
Floating labels
The label sits inside the input and moves up when you type — a clean, modern look.
<div class="form-floating">
<input type="email" class="form-control" id="email" placeholder="name@example.com">
<label for="email">Email address</label>
</div>
Rules: the input comes before the label, and the input must have a placeholder (it is not shown, but needed for the effect).
Example
Example — Login form with floating labels and input groups
HTML
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.3/dist/css/bootstrap.min.css" rel="stylesheet">
<div class="container my-4" style="max-width: 380px;">
<h4 class="mb-3">Login</h4>
<div class="form-floating mb-3">
<input type="email" class="form-control" id="email" placeholder="name@example.com">
<label for="email">Email address</label>
</div>
<div class="input-group mb-3">
<div class="form-floating">
<input type="password" class="form-control" id="pass" placeholder="Password">
<label for="pass">Password</label>
</div>
<button class="btn btn-outline-secondary" type="button" id="toggle">Show</button>
</div>
<div class="input-group mb-3">
<span class="input-group-text">+91</span>
<input type="tel" class="form-control" placeholder="Mobile number">
</div>
<div class="input-group mb-3">
<input type="search" class="form-control" placeholder="Search tutorials">
<button class="btn btn-primary">Search</button>
</div>
<button class="btn btn-success w-100">Login</button>
</div>
<script>
document.getElementById('toggle').onclick = function () {
const p = document.getElementById('pass');
p.type = p.type === 'password' ? 'text' : 'password';
this.textContent = p.type === 'password' ? 'Show' : 'Hide';
};
</script>