responsive spacing (i.e. mb-lg-2 mb-sm-3 etc) not working in Bootstrap 5

Viewed 3149

In bootstrap 4 these classes were working fine. But they are not working in Bootstrap 5. Any idea why?

Note: d-block d-lg-flex , text-center text-lg-start text-md-end these are working fine. Looks like just margin and padding related classes are not working.

Sample code:

 <div class="d-block d-lg-flex justify-content-center flex-row bd-highlight ">
    <div class="mb-0 mb-md-3 mb-lg-0">
        <div class="dropdown text-center cairo ">
            <select x-model="selectedUnits" class="form-select feature_text" aria-label="Default select example">
                <option selected="" disabled="">Select unit amount</option>
                <option value="myval">1 unit</option>
                <option value="myval">1 unit</option>
                <option value="myval">1 unit</option>
            </select>
        </div>
    </div>
</div>
2 Answers

The margin classes mb-0 mb-md-3 mb-lg-0 should work as expected in both Bootstrap 4 and Bootstrap 5.

Responsive margin bottom working in Bootstrap 5

However text-lg-left text-md-right has changed to text-lg-start text-md-end in Bootstrap 5

2021 in bootstrap 5 Margin and Padding :

Margin

  • Margin Margin top: mt-value
  • Margin right: me-value
  • Margin bottom: mb-value
  • Margin left: ms-value

Padding

  • Padding top: pt-value
  • Padding right: pe-value
  • Padding bottom: pb-value
  • Paddig left: ps-value.

The range for the value is 0 to 5(Ex:- pt-1 for Padding top)

Related