Bird
Raised Fist0
Bootsrapmarkup~20 mins

Gutters and spacing control in Bootsrap - Practice Problems & Coding Challenges

Choose your learning style10 modes available
Challenge - 5 Problems
🎖️
Gutters and Spacing Master
Get all challenges correct to earn this badge!
Test your skills under time pressure!
🧠 Conceptual
intermediate
2:00remaining
Understanding Bootstrap Gutters
In Bootstrap, what does the g-3 class do when applied to a .row element?
AIt adds a 3rem (48px) margin outside the row.
BIt removes all gutters between columns.
CIt sets horizontal and vertical gutters to 1.5rem (24px) between columns.
DIt sets horizontal and vertical gutters to 1rem (16px) between columns.
Attempts:
2 left
💡 Hint
Remember, gutter classes like g-* control spacing inside rows between columns.
📝 Syntax
intermediate
2:00remaining
Correct Use of Spacing Utility Classes
Which option correctly adds a top margin of 3 (1rem) and horizontal padding of 4 (1.5rem) to a Bootstrap element?
Aclass="mt-3 px-4"
Bclass="mt-4 px-3"
Cclass="mb-3 pl-4"
Dclass="pt-3 mx-4"
Attempts:
2 left
💡 Hint
Top margin uses mt-*, horizontal padding uses px-*.
❓ layout
advanced
2:00remaining
Effect of Removing Gutters in a Grid
Given this Bootstrap grid code, what will be the visual effect of adding g-0 to the .row?
Bootsrap
<div class="row g-0">
  <div class="col-6 bg-primary text-white">Left</div>
  <div class="col-6 bg-secondary text-white">Right</div>
</div>
AThe columns will have extra large gutters of 3rem between them.
BThe columns will have default gutters of 1.5rem between them.
CThe two columns will have no space between them, touching each other directly.
DThe columns will stack vertically instead of side by side.
Attempts:
2 left
💡 Hint
The g-0 class removes all gutters inside the row.
❓ accessibility
advanced
2:00remaining
Spacing and Accessibility Considerations
Why is it important to maintain consistent gutters and spacing in a Bootstrap layout for accessibility?
ARemoving gutters improves keyboard navigation by reducing tab stops.
BConsistent spacing helps users with cognitive disabilities understand content grouping and improves readability.
CSpacing only affects visual style and has no impact on accessibility.
DLarge gutters confuse screen readers and should be avoided.
Attempts:
2 left
💡 Hint
Think about how spacing helps organize content visually and logically.
❓ selector
expert
3:00remaining
Targeting Bootstrap Gutters with CSS
You want to override Bootstrap's horizontal gutter spacing only on medium screens and larger. Which CSS selector and property correctly targets the horizontal padding inside columns for .row with g-3?
A@media (min-width: 768px) { .row.g-3 > [class*='col-'] { padding-left: 0.5rem; padding-right: 0.5rem; } }
B@media (min-width: 768px) { .row.g-3 > [class^='col'] { margin-left: 0.5rem; margin-right: 0.5rem; } }
C@media (min-width: 768px) { .row.g-3 > [class*='col-'] { padding-left: 1.5rem; padding-right: 1.5rem; } }
D@media (max-width: 768px) { .row.g-3 > [class*='col-'] { padding-left: 0; padding-right: 0; } }
Attempts:
2 left
💡 Hint
Bootstrap columns use padding for gutters, and medium breakpoint starts at 768px.

Practice

(1/5)
1. What does the Bootstrap class g-3 do in a grid layout?
easy
A. Removes all gutters between columns
B. Adds a medium gutter spacing between columns
C. Adds padding inside each column
D. Centers the grid horizontally

Solution

  1. Step 1: Understand gutter classes in Bootstrap

    The class g-3 sets the gutter size between columns to a medium spacing level.
  2. Step 2: Differentiate gutters from padding and margin

    Gutters control space between columns, not inside columns (padding) or outside elements (margin).
  3. Final Answer:

    Adds a medium gutter spacing between columns -> Option B
  4. Quick Check:

    Gutter size 3 means medium space between columns [OK]
Hint: Gutter classes control space between columns, not inside elements [OK]
Common Mistakes:
  • Confusing gutters with padding or margin
  • Thinking g-3 removes gutters
  • Assuming gutters center content
2. Which Bootstrap class correctly removes all horizontal gutters between columns?
easy
A. gx-0
B. gy-0
C. g-0
D. g-5

Solution

  1. Step 1: Understand gutter axis classes

    gx-0 removes horizontal gutters (x-axis), gy-0 removes vertical gutters (y-axis), and g-0 removes both.
  2. Step 2: Identify the class that removes only horizontal gutters

    Since the question asks for horizontal gutters only, gx-0 is correct.
  3. Final Answer:

    gx-0 -> Option A
  4. Quick Check:

    gx-0 removes horizontal gutters only [OK]
Hint: gx controls horizontal gutters, gy controls vertical gutters [OK]
Common Mistakes:
  • Using g-0 removes all gutters, not just horizontal
  • Confusing gx and gy classes
  • Choosing g-5 which adds large gutters
3. Given this HTML snippet:
<div class='row gx-4'>
  <div class='col'>A</div>
  <div class='col'>B</div>
</div>

What is the effect of gx-4 on the columns?
medium
A. Adds large horizontal space between columns
B. Adds small vertical space between columns
C. Removes all gutters between columns
D. Adds padding inside each column

Solution

  1. Step 1: Identify gutter axis and size

    The class gx-4 sets horizontal gutters (x-axis) to size 4, which is large spacing.
  2. Step 2: Understand gutter effect on columns

    This adds horizontal space between the columns but does not affect vertical spacing or padding inside columns.
  3. Final Answer:

    Adds large horizontal space between columns -> Option A
  4. Quick Check:

    gx-4 means large horizontal gutters [OK]
Hint: gx controls horizontal gutters; 4 means large space [OK]
Common Mistakes:
  • Confusing vertical and horizontal gutters
  • Thinking gutters add padding inside columns
  • Assuming gx-4 removes gutters
4. You want to remove vertical gutters but keep horizontal gutters at size 3. Which class combination is correct?
medium
A. gy-3 gx-0
B. gx-0 gy-3
C. gy-0 gx-3
D. g-0 g-3

Solution

  1. Step 1: Understand axis gutter classes

    gy-0 removes vertical gutters, gx-3 sets horizontal gutters to size 3.
  2. Step 2: Check each option

    gy-0 gx-3 correctly removes vertical gutters and sets horizontal gutters to 3. Others either reverse axes or conflict.
  3. Final Answer:

    gy-0 gx-3 -> Option C
  4. Quick Check:

    gy-0 removes vertical, gx-3 sets horizontal gutters [OK]
Hint: gy controls vertical gutters, gx controls horizontal gutters [OK]
Common Mistakes:
  • Swapping gx and gy classes
  • Using g-0 removes all gutters
  • Combining conflicting gutter sizes
5. You have a grid with 3 columns and want to add equal spacing inside each column and between columns. Which Bootstrap classes should you combine?
hard
A. Use gx-3 on the row and m-2 on each column
B. Use g-0 on the row and m-3 on each column
C. Use gy-0 on the row and p-0 on each column
D. Use g-2 on the row and p-3 on each column

Solution

  1. Step 1: Add spacing between columns with gutters

    Using g-2 on the row adds equal gutters (spacing) between all columns.
  2. Step 2: Add spacing inside each column with padding

    Adding p-3 on each column adds equal padding inside each column for internal spacing.
  3. Final Answer:

    Use g-2 on the row and p-3 on each column -> Option D
  4. Quick Check:

    Gutters add space between columns; padding adds space inside columns [OK]
Hint: Combine gutters on row and padding on columns for full spacing [OK]
Common Mistakes:
  • Using margin instead of padding inside columns
  • Removing gutters accidentally with g-0
  • Adding padding on row instead of columns
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