HTML & CSS · Junior · Question 28 of 75
A container has display: flex; flex-direction: column; justify-content: center. How are its children aligned?
- 1Centered horizontally, just like in a regular row
- ✓Correct answer: Centered vertically (if the container has free height)
- 3Not at all:
justify-contentdoesn't work withflex-direction: column
Explanation
With flex-direction: column the main axis becomes vertical, so justify-content: center centers items vertically. Horizontal alignment is controlled by align-items in this case. The effect is visible only if the container is taller than its content.