I want to set a fixed minimum width for a container while ignoring small sizes like sm
and xs
. Basically, when the screen size is less than 960px
, I want the width to be fixed and only display a scroll.
This is the code I have:
<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
:
https://i.sstatic.net/8M3GtAgT.png
when md
https://i.sstatic.net/xVFQ5PJi.png
However, when the screen width is smaller than 960px
, the sm
& xs
breakpoints are not being ignored even though scrolling is displayed.
https://i.sstatic.net/WxYy8Xuw.png
I am looking for a solution to maintain a fixed width whenever the screen size is smaller than 960px
Here is a rough image:
https://i.sstatic.net/trazgVVy.png
Any ideas on how to tackle this issue?
#Edit
I'm not sure why the negative feedback? I just want to clarify why I need a solution: I have two different views in my project - desktop and mobile. I determine the client device type and serve the appropriate view accordingly. For desktop views, I want to set a fixed minimum width and ignore small breakpoints, while for mobile views, I want to use small breakpoints only and ignore larger sizes. I am using bootstrap 5
for this project but haven't found the answer yet.