What is wrong if the items are not horizontally centered as expected?
medium
A. Using flex-column disables centering.
B. Missing align-items-center to center items horizontally in column layout.
C. The d-flex class is misspelled.
D. Items cannot be centered in flexbox.
Solution
Step 1: Understand flex-column and justify-content-center
In a column flex container, justify-content-center centers items vertically along the main axis.
Step 2: Check horizontal centering
To center items horizontally (cross axis), align-items-center is needed but missing here.
Final Answer:
Missing align-items-center to center items horizontally in column layout. -> Option B
Quick Check:
Column layout needs align-items-center for horizontal centering [OK]
Hint: Use align-items-center for cross-axis centering in flex-column [OK]
Common Mistakes:
Assuming justify-content-center centers horizontally in column
Thinking flex-column disables centering
Ignoring need for align-items in cross axis
5. You want a responsive navbar with items spaced evenly across the width on large screens, but stacked vertically on small screens. Which Bootstrap flex utility classes should you use on the container?
hard
A. d-flex flex-column flex-lg-row justify-content-between
B. d-flex flex-row flex-lg-column justify-content-center
C. d-flex flex-column justify-content-center flex-lg-row
D. d-flex flex-row justify-content-between flex-lg-column
Solution
Step 1: Understand responsive flex directions
Use flex-column for small screens (default) to stack vertically, and flex-lg-row for large screens to arrange horizontally.
Step 2: Space items evenly on large screens
justify-content-between spaces items evenly across the container width on the main axis (horizontal in row).
Final Answer:
d-flex flex-column flex-lg-row justify-content-between -> Option A
Quick Check:
Responsive flex: column small, row large + spaced between [OK]
Hint: Combine flex-column and flex-lg-row for responsive layout [OK]
Common Mistakes:
Mixing up flex directions for screen sizes
Forgetting justify-content-between for spacing
Using justify-content-center instead of between
Recommended
Ready to prove it?
Pass the test and this pattern moves unknownstrongwhile earning +1 Grip toward your certificate.