Discover how a simple 12-part grid can save you hours of layout headaches!
Why Column sizing (col-1 through col-12) in Bootsrap? - Purpose & Use Cases
Imagine you want to create a webpage layout with multiple sections side by side. You try to set widths by guessing pixel values for each part, like 100px for one column and 200px for another.
When the screen size changes or you add more content, your fixed widths break the layout. You have to recalculate and rewrite all widths manually for every device size, which is slow and frustrating.
Bootstrap's column sizing with col-1 through col-12 lets you divide the page into 12 equal parts. You pick how many parts each column takes, and the layout adjusts automatically on different screens.
div style="width:100px; float:left;" ... div style="width:200px; float:left;" ...
<div class="col-4">...</div><div class="col-8">...</div>
You can build flexible, responsive layouts that adapt smoothly to any screen size without rewriting widths.
On a blog page, you can have a sidebar taking 3 columns and main content taking 9 columns. On mobile, these columns stack nicely without extra work.
Manual width setting is hard to maintain and breaks on different screens.
Bootstrap columns divide space into 12 parts for easy sizing.
Layouts become flexible and responsive automatically.
Practice
col-6 mean in a grid layout?Solution
Step 1: Understand Bootstrap grid system
Bootstrap divides a row into 12 equal parts for layout.Step 2: Interpret
The classcol-6col-6means the column uses 6 of those 12 parts, which is half the row width.Final Answer:
The column takes up half the width of the row (6 out of 12 parts). -> Option AQuick Check:
col-6 means 6/12 width = half [OK]
- Thinking col-6 means 6 pixels wide
- Confusing col-6 with number of columns inside
- Assuming col-6 hides the column on small screens
Solution
Step 1: Calculate quarter width in 12 parts
One quarter of 12 parts is 12 ÷ 4 = 3 parts.Step 2: Match with Bootstrap class
The classcol-3means 3 parts width, which is one quarter.Final Answer:
<code>col-3</code> -> Option AQuick Check:
3 parts = 1/4 width [OK]
- Choosing col-4 which is one third, not quarter
- Confusing col-6 as quarter width
- Picking col-9 which is three quarters
<div class='row'> <div class='col-4'>A</div> <div class='col-8'>B</div> </div>
How will the columns appear on a large screen?
Solution
Step 1: Understand col-4 and col-8 widths
col-4means 4 parts out of 12 (1/3),col-8means 8 parts out of 12 (2/3).Step 2: Check layout behavior in Bootstrap
Columns inside arowappear side by side if total is 12 or less.Final Answer:
Column A takes 1/3 width, Column B takes 2/3 width side by side. -> Option CQuick Check:
4 + 8 = 12 parts, side by side [OK]
- Thinking columns stack vertically by default
- Mixing up col-4 and col-8 widths
- Assuming col-4 means 1/4 width
<div class='row'> <div class='col-5'>X</div> <div class='col-8'>Y</div> </div>
Solution
Step 1: Add column widths
col-5 means 5 parts, col-8 means 8 parts; total is 5 + 8 = 13 parts.Step 2: Check Bootstrap grid rules
Columns in a row should add up to 12 or less for proper layout; more than 12 breaks layout.Final Answer:
The columns add up to more than 12, causing layout issues. -> Option BQuick Check:
5 + 8 = 13 > 12 breaks layout [OK]
- Thinking col-5 or col-8 are invalid classes
- Assuming columns stack because of size difference
- Ignoring total width exceeding 12
- The first column is 3 parts wide
- The second column is twice as wide as the first
- The third column fills the remaining space
Which Bootstrap classes should you use?
Solution
Step 1: Assign widths based on conditions
First column = 3 parts; second column = twice first = 6 parts.Step 2: Calculate remaining space for third column
Total so far: 3 + 6 = 9 parts; remaining = 12 - 9 = 3 parts.Step 3: Match with Bootstrap classes
Usecol-3,col-6, andcol-3for the three columns respectively.Final Answer:
<code>col-3</code>, <code>col-6</code>, <code>col-3</code> -> Option DQuick Check:
3 + 6 + 3 = 12 parts total [OK]
- Choosing widths that sum over 12
- Not doubling the first column width correctly
- Assigning third column more than remaining space
Ready to prove it?
Pass the test and this pattern moves unknown
