Discover how a simple 12-part grid can save you hours of frustrating layout work!
Why 12-column grid model in Bootsrap? - Purpose & Use Cases
Imagine you want to create a webpage layout with three sections side by side. You try to position each section by guessing widths and adding spaces manually.
Manually setting widths and spaces is slow and tricky. If you change one section's size, you must adjust all others by hand. It's easy to break the layout, especially on different screen sizes.
The 12-column grid model divides the page into 12 equal parts. You just assign how many columns each section uses. The grid automatically arranges sections neatly and adapts to screen sizes.
<div style="width:30%; float:left;">Section 1</div> <div style="width:30%; float:left; margin-left:5%;">Section 2</div> <div style="width:30%; float:left; margin-left:5%;">Section 3</div>
<div class="row"> <div class="col-4">Section 1</div> <div class="col-4">Section 2</div> <div class="col-4">Section 3</div> </div>
You can build clean, balanced layouts quickly that look good on phones, tablets, and desktops without extra work.
News websites use the 12-column grid to show headlines, images, and ads side by side. When you resize the browser, everything stays organized and easy to read.
Manual width setting is hard and breaks easily.
The 12-column grid splits the page into equal parts for easy layout.
Layouts become flexible and responsive across devices.
Practice
Solution
Step 1: Understand the 12-column grid concept
The grid divides the page width into 12 equal parts, so columns in a row must add up to 12 or less.Step 2: Apply the rule to column combinations
You can combine columns as long as their total width does not exceed 12, ensuring the layout fits perfectly.Final Answer:
Up to 12 columns combined -> Option CQuick Check:
Sum of columns ≤ 12 = Up to 12 columns combined [OK]
- Thinking you can use more than 12 columns in one row
- Assuming exactly 6 columns are required
- Believing any number of columns works
Solution
Step 1: Identify the class for column width
Bootstrap uses classes likecol-4to specify a column that spans 4 of the 12 grid columns.Step 2: Match the class to the required width
Since we want 4 columns wide,col-4is the correct class.Final Answer:
col-4 -> Option DQuick Check:
Class for 4 columns = col-4 [OK]
- Using col-12 which spans full width
- Choosing col-8 or col-6 which are wider than 4 columns
- Confusing col-4 with col-14 (invalid)
<div class="row"> <div class="col-3">A</div> <div class="col-6">B</div> <div class="col-3">C</div> </div>
Solution
Step 1: Calculate total column width in the row
Sum of columns: 3 + 6 + 3 = 12, which fits exactly in one row.Step 2: Understand Bootstrap layout behavior
Since total is 12, all columns appear side by side in one row with widths proportional to 3, 6, and 3.Final Answer:
Three columns in one row with widths 3, 6, and 3 -> Option AQuick Check:
Total columns = 12 means one row layout [OK]
- Assuming columns exceed 12 and wrap to next row
- Thinking columns stack vertically by default
- Believing only one column shows
<div class="row"> <div class="col-5">X</div> <div class="col-8">Y</div> </div>
Solution
Step 1: Add column widths to check total
5 + 8 = 13, which is more than 12 allowed per row.Step 2: Understand Bootstrap grid rules
When total exceeds 12, columns wrap or break layout, causing unexpected results.Final Answer:
Total columns exceed 12, causing layout break -> Option AQuick Check:
Sum > 12 means layout error [OK]
- Ignoring total column width sum
- Thinking 5 and 8 fit in one row
- Assuming class names are wrong
Solution
Step 1: Match small screen classes
First column: 3 columns on small =col-sm-3, second: 6 columns =col-sm-6, third: 3 columns =col-sm-3.Step 2: Match medium screen classes
First column: 6 columns on medium =col-md-6, second: 3 columns =col-md-3, third: 3 columns =col-md-3.Step 3: Verify option matches all classes
col-sm-3 col-md-6, col-sm-6 col-md-3, col-sm-3 col-md-3 matches all these class assignments correctly.Final Answer:
col-sm-3 col-md-6, col-sm-6 col-md-3, col-sm-3 col-md-3 -> Option BQuick Check:
Responsive classes match screen sizes [OK]
- Mixing up small and medium class prefixes
- Using col-* without breakpoint for responsiveness
- Swapping column sizes between breakpoints
Ready to prove it?
Pass the test and this pattern moves unknown
