'How can I apply Bootstrap position classes on specific screen sizes?
I have this HTML element with Bootstrap5 utility classes for position:
<div class="position-absolute bottom-0 w-100 text-center mb-2">
Content
</div>
I need to remove the class position-absolute on the mobile screen using bootstrap utilities
Solution 1:[1]
Bootstrap position classes are not responsive (except for sticky). You'll need to create your own custom class. You may be able to use breakpoint mixins to automatically get the breakpoint sizes:
@include media-breakpoint-only(xs) {
.position-xs-only-absolute {
position: absolute;
}
}
Otherwise, use standard media queries which correspond to Bootstrap's breakpoints.
@media (max-width: 575px) {
.position-xs-only-absolute {
position: absolute;
}
}
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 |
