Bootstrap Q&A Logo
Bootstrap Q&A Part of the Q&A Network
Q&A Logo

How can I align feedback text with input fields in a Bootstrap input group with validation?

Asked on Nov 12, 2025

Answer

To align feedback text with input fields in a Bootstrap input group, use the `is-invalid` or `is-valid` classes for validation, and place the feedback text within a `
` with the `invalid-feedback` or `valid-feedback` class.
<!-- BEGIN COPY / PASTE -->
        <div class="mb-3">
            <div class="input-group has-validation">
                <input type="text" class="form-control is-invalid" placeholder="Enter text">
                <div class="invalid-feedback">
                    Please provide a valid input.
                </div>
            </div>
        </div>
        <!-- END COPY / PASTE -->
Additional Comment:
  • Use the `is-invalid` class on the input field to trigger the invalid feedback.
  • Place the feedback text inside a `
    ` with the `invalid-feedback` class immediately following the input.
  • The `has-validation` class on the input group ensures proper alignment and styling.
  • For valid feedback, use `is-valid` and `valid-feedback` classes instead.
✅ Answered with Bootstrap 5 best practices.
← Back to All Questions
The Q&A Network