Skip to content

Courses / CSS3 Mastery: Beginner to Advanced / Advanced Flexbox

2,092 people viewed this

Advanced Flexbox

This layout lets cards grow, shrink and wrap based on available space. The precise number of cards per row depends on the container width and item sizing.

Practice Exercise

Build a card row that wraps on narrow screens. Use flex-grow, flex-shrink, flex-basis, align-self and min-width: 0. Check both the visual layout and the source order.

Quiz — 10 MCQs

  1. What does flex-wrap: wrap allow? (A) Items to form multiple lines (B) Items to disappear (C) Text to become bold (D) A new database. Answer: A. Wrapping creates additional flex lines when needed.
  2. What does flex-grow control? (A) Distribution of positive free space (B) Font size (C) Border color (D) HTML nesting. Answer: A. Grow factors determine how free space is shared.
  3. What does flex-shrink control? (A) Shrinking under negative free space (B) Text capitalization (C) Image format (D) Selector specificity. Answer: A. Shrink factors help distribute negative free space.
  4. What does flex-basis specify? (A) Initial main-size basis (B) Text color (C) Outline width (D) Position type. Answer: A. Flex basis establishes an item's initial main-size basis.
  5. Which property overrides align-items for an individual item? (A) align-self (B) justify-content (C) flex-wrap (D) order only. Answer: A. Align-self provides per-item cross-axis alignment.
  6. What does align-content distribute? (A) Flex lines on the cross axis (B) Letters in a word (C) Database rows (D) Borders. Answer: A. It aligns multiple lines when cross-axis space is available.
  7. Does order change DOM source order? (A) Yes (B) No (C) Only for buttons (D) Only in Firefox. Answer: B. It changes visual ordering, not the underlying source order.
  8. Why might min-width: 0 be needed on a flex item? (A) To allow shrinking below its automatic minimum size (B) To force a 100px width (C) To hide it (D) To create a grid. Answer: A. It can remove the automatic minimum-width constraint.
  9. Which shorthand can define grow, shrink and basis? (A) flex (B) font (C) border (D) outline. Answer: A. The flex shorthand controls these sizing factors.
  10. Should visual order conflict with logical keyboard navigation order? (A) Yes (B) No (C) Only on phones (D) Always. Answer: B. Maintain a meaningful DOM order for accessibility.

Key Takeaways

  • Flexbox supports wrapping and flexible item sizing.
  • Understand grow, shrink and basis together.
  • Use align-content for lines and align-self for individual items.
  • Preserve logical source order for accessibility.

Rate this course

No ratings yet — yours can be the first.

Stars show on this course. Your written note stays private.

Your stars