Use media query to only apply the fixed position above a specific screen width. For example 768px is the Bootstrap 4 md
breakpoint:
CSS (min-height
is optional):
@media (min-width: 768px) {
.fixed-posi {
width: 50%;
margin-left: 50%;
min-height:100%;
position:fixed;
}
}
Then, use fixed-posi
in the layout like this...
<div class="row">
<div class="col-md-6">
Content goes here...
</div>
<div class="col-md-6 fixed-posi">Content goes here... (fixed position)
</div>
</div>
Demo: https://www.codeply.com/go/751CygARyO
Similar question (fixed DIV on left): How to left column fixed and right scrollable in Bootstrap 4, responsive?