I’m trying set a fixed minimal width for container and ignoring small sizes (sm
,xs
). In short when the screen size is smaller than 960px
width, must be fixed and just display scroll.
Code in my case:
<div class="container" style="min-width: 960px">
<div class="row">
<div class="col-md-6 col-lg-3 bg-primary">1</div>
<div class="col-md-6 col-lg-3 bg-secondary">2</div>
<div class="col-md-6 col-lg-3 bg-info">3</div>
<div class="col-md-6 col-lg-3 bg-warning">4</div>
</div>
</div>
result:
when lg
:
And when the screen width is smaller then 960px
sm & xs
breakpoints are not ignored even though scrolling is displayed.
I would like fixed width whenever screen size smaller then 960px
rough image:
How to solve this question?
#Edit
I don’t know why negative rating? I want to explain why I need it solution: in my project two views: desktop views and mobile views. Every time when a client makes a request detected a client device type. If desktop returning data by desktop views or by mobile view when mobile device also. So I just want to fixed minimal width on desktop devices and ignoring all small breakpoints and vice versa on mobile device use only small breakpoints and ignoring all large sizes. I choose bootstrap 5
for my task. I don’t know the answer to that yet.
2
Answers
Solid by
scss
andreact-bootstrap
. First set maximal width for any container in scss config:set minimal width for body:
and by
react-bootstrap
:it's working just fine.
Instead of using
min-width
, try to use max-width, so it restrict with not to more than 960px.then add
col-sm-12
inside of col div’s.