CSS justify-content & align-items
- type
- property (on the flex container)
- applies to
- a flex container
- inherits
- no
- common values
- justify-content: flex-start/center/space-between; align-items: stretch/center
Where it goes
On the parent that has display: flex. Never on the items themselves.
Example
.row {
display: flex;
justify-content: space-between;
align-items: center;
}Common mistakes
- Mixing up which one goes which way. In a row, justify-content is left to right and align-items is top to bottom.
- Using justify-content to center one item top to bottom. In a row, that is align-items.