Bird
Raised Fist0
Bootsrapmarkup~10 mins

Responsive column classes in Bootsrap - Browser Rendering Trace

Choose your learning style10 modes available
Render Flow - Responsive column classes
[Read HTML with col classes] -> [Create DOM elements] -> [Parse CSS media queries] -> [Match viewport width] -> [Apply appropriate col-* classes] -> [Calculate column widths] -> [Layout columns in row] -> [Paint columns] -> [Composite final page]
The browser reads the HTML with Bootstrap column classes, then applies CSS media queries based on screen size to adjust column widths responsively, laying out columns side-by-side or stacked depending on viewport width.
Render Steps - 3 Steps
Code Added:<div class="col-12">Column 1</div> and <div class="col-12">Column 2</div>
Before
[container]
  [row]
    [ ]
    [ ]
→
After
[container]
  [row]
    [Column 1__________]
    [Column 2__________]
Both columns take full width (12 units) stacking vertically on small screens.
🔧 Browser Action:Creates block-level columns stacked vertically
Code Sample
Two columns stack vertically on small screens and sit side-by-side equally on medium and larger screens.
Bootsrap
<div class="container">
  <div class="row">
    <div class="col-12 col-md-6">Column 1</div>
    <div class="col-12 col-md-6">Column 2</div>
  </div>
</div>
Render Quiz - 3 Questions
Test your understanding
After applying col-12 and col-md-6 classes (render_step 2), how do the columns appear on a large screen?
ATwo columns side-by-side each taking half the width
BTwo columns stacked vertically each full width
COne column taking full width, the other hidden
DColumns overlap each other
Common Confusions - 2 Topics
Why do columns stack vertically on small screens even though I used col-md-6?
Because col-md-6 applies only on medium screens and larger. On smaller screens, col-12 or default stacking applies, so columns take full width and stack vertically (see render_steps 1 and 3).
💡 Responsive classes apply only at their breakpoint and above; smaller screens use default or smaller breakpoint classes.
What happens if I only use col-6 without any breakpoint prefix?
The columns will always be half width on all screen sizes, never stacking vertically (unlike col-md-6 which stacks below medium). This can cause layout issues on very small screens.
💡 Use breakpoint prefixes to control when columns stack or sit side-by-side.
Property Reference
ClassBreakpointColumn WidthVisual EffectCommon Use
col-12None (all screens)100%Full width column, stacks verticallySmall screens or default
col-sm-6≥576px50%Half width columns side-by-sideSmall devices and up
col-md-6≥768px50%Half width columns side-by-sideMedium devices and up
col-lg-4≥992px33.33%One third width columns side-by-sideLarge devices and up
col-xl-3≥1200px25%One quarter width columns side-by-sideExtra large devices and up
Concept Snapshot
Bootstrap responsive columns use classes like col-12, col-md-6. col-12 means full width on all screens. col-md-6 means half width on medium (≥768px) and larger screens. Columns stack vertically on small screens, side-by-side on medium+. Use breakpoint prefixes to control layout at different screen sizes.

Practice

(1/5)
1. What does the Bootstrap class col-md-6 do in a responsive layout?
easy
A. Makes the column take half the width on medium and larger screens
B. Makes the column take full width on all screen sizes
C. Makes the column hidden on medium screens
D. Makes the column take one-sixth width on medium screens

Solution

  1. Step 1: Understand the class format

    The class col-md-6 means the column uses 6 parts out of 12 on medium (≥768px) screens and larger.
  2. Step 2: Interpret the width fraction

    Since Bootstrap grid is divided into 12 parts, 6 parts equal half the width.
  3. Final Answer:

    Makes the column take half the width on medium and larger screens -> Option A
  4. Quick Check:

    col-md-6 = half width on medium+ [OK]
Hint: Remember 12-grid system: number means parts of 12 width [OK]
Common Mistakes:
  • Thinking it applies to all screen sizes
  • Confusing '6' with percentage instead of grid parts
  • Assuming it hides the column
2. Which of the following is the correct Bootstrap class to make a column full width on small screens and half width on large screens?
easy
A. col-sm-12 col-lg-6
B. col-lg-12 col-sm-6
C. col-6 col-lg-12
D. col-sm-6 col-lg-12

Solution

  1. Step 1: Understand screen size prefixes

    sm means small screens (≥576px), lg means large screens (≥992px).
  2. Step 2: Match widths to screen sizes

    We want full width (12 parts) on small screens and half width (6 parts) on large screens, so col-sm-12 col-lg-6 fits.
  3. Final Answer:

    col-sm-12 col-lg-6 -> Option A
  4. Quick Check:

    Full width small + half large = col-sm-12 col-lg-6 [OK]
Hint: Use smaller breakpoint first, then larger breakpoint classes [OK]
Common Mistakes:
  • Reversing the order of breakpoints
  • Using wrong numbers for widths
  • Mixing up screen size prefixes
3. Given the HTML snippet:
<div class="row">
  <div class="col-12 col-md-8">Content A</div>
  <div class="col-6 col-md-4">Content B</div>
</div>

What will be the layout on a medium screen (≥768px)?
medium
A. Content A and B both take full width stacked vertically
B. Content A takes full width, Content B takes half width stacked
C. Content A takes 8/12 width, Content B takes 4/12 width side by side
D. Content A takes 6/12 width, Content B takes 6/12 width side by side

Solution

  1. Step 1: Identify classes active at medium screen

    At medium (≥768px), col-md-8 and col-md-4 apply, overriding smaller screen classes.
  2. Step 2: Calculate widths

    Content A uses 8 parts out of 12, Content B uses 4 parts out of 12, so they sit side by side with those widths.
  3. Final Answer:

    Content A takes 8/12 width, Content B takes 4/12 width side by side -> Option C
  4. Quick Check:

    col-md-8 + col-md-4 = full row split 8/4 [OK]
Hint: At breakpoint, use col-{breakpoint}-X classes, ignore smaller ones [OK]
Common Mistakes:
  • Using col-12 and col-6 widths instead of col-md-*
  • Thinking columns stack vertically on medium screens
  • Confusing which class overrides which
4. You wrote this code:
<div class="row">
  <div class="col-sm-6 col-md-4">Box 1</div>
  <div class="col-sm-6 col-md-4">Box 2</div>
  <div class="col-sm-6 col-md-4">Box 3</div>
</div>

But on small screens, Box 3 drops to a new line instead of staying in the same row. Why?
medium
A. Because col-sm-6 means full width on small screens
B. Because col-md-4 overrides col-sm-6 on small screens
C. Because the row class is missing
D. Because three columns of col-sm-6 each exceed 12 grid units, causing wrap

Solution

  1. Step 1: Calculate total width on small screens

    Each column uses col-sm-6, meaning 6 parts out of 12, so two columns fit per row (6+6=12).
  2. Step 2: Understand why Box 3 wraps

    Three columns each 6 parts wide total 18 parts, which is more than 12, so Box 3 wraps to next line.
  3. Final Answer:

    Because three columns of col-sm-6 each exceed 12 grid units, causing wrap -> Option D
  4. Quick Check:

    6+6+6 > 12 causes wrap [OK]
Hint: Sum col widths per row; >12 means wrap to next line [OK]
Common Mistakes:
  • Thinking col-md-4 affects small screens
  • Assuming row class is missing
  • Misunderstanding col-sm-6 width
5. You want a layout where on extra small screens all columns stack full width, on small screens two columns share the row equally, and on large screens three columns share the row equally. Which class set achieves this?
hard
A. col-6 col-sm-12 col-lg-4
B. col-12 col-sm-6 col-lg-4
C. col-sm-12 col-md-6 col-lg-4
D. col-12 col-md-4 col-lg-6

Solution

  1. Step 1: Define widths for extra small screens

    col-12 makes columns full width on extra small screens (default).
  2. Step 2: Define widths for small screens

    col-sm-6 makes two columns per row (6+6=12) on small screens.
  3. Step 3: Define widths for large screens

    col-lg-4 makes three columns per row (4+4+4=12) on large screens.
  4. Final Answer:

    col-12 col-sm-6 col-lg-4 -> Option B
  5. Quick Check:

    Stack, then 2 per row, then 3 per row = col-12 col-sm-6 col-lg-4 [OK]
Hint: Start from smallest screen, add classes for bigger breakpoints [OK]
Common Mistakes:
  • Mixing breakpoint order
  • Using wrong numbers for equal columns
  • Forgetting default col-12 for stacking
Recommended

Ready to prove it?

Pass the test and this pattern moves unknown strong while earning +1 Grip toward your certificate.

10 questions~5 mineasy hard