col - Mobile
Goal
- âš¡ Satisfy Mobile layout requirement
Requirements
- ⬜ Desktop => 6 columns
- ⬜ Tablet => 3 columns
- ⬜ Mobile => 2 columns
Check device viewport width
info
The browser's
viewport
is the area of the window in which web content can be seen.
https://developer.mozilla.org/en-US/docs/Mozilla/Mobile/Viewport_meta_tag
You see iPhone 6 viewport width is 375px
Check grid options tables
Then, let's check this tables.
Ref: https://getbootstrap.com/docs/4.5/layout/grid/#grid-options
This tables show which col-xx
to use for each viewport width.
This is why I checked device viewport width.
info
- We need to use
col-
for mobile layout (ex iPhone 6: 375px < 576px) - We want mobile layout 2 columns => use
col-6
col-6
for 2 columns ?
Why info
Maximum number of columns in row is 12
info
Don't worry you will get used to it gradually.
col-sm
to col-6
Change Change every col-sm
to col-6
Check the current output
caution
Grid breakpoints are based on minimum width media queries, meaning they apply to that one breakpoint and all those above it
This is why, currently in every devices, the layout is 2 columns.
In the next step, let's satisfy Tablet layout by fixing this problem.