build.log
Quay lai ghi chu
CSS
Cap nhat 10 thg 1, 2026

CSS Layout Decision Tree

When to use Flexbox vs Grid vs other layout methods. A practical decision guide.

css
layout
flexbox
grid

Use Flexbox When - Layout is one-dimensional (row OR column) - You need to distribute space among items - Alignment and centering are the main goals - Content size should determine layout

Use Grid When - Layout is two-dimensional (rows AND columns) - You need precise placement control - You want the layout to determine content size - Complex responsive layouts without media queries

Use Neither When - Simple stacking: normal flow handles it - Overlapping: use `position: absolute/relative` - Full-page centering: `margin: auto` or grid `place-items: center`