# order

> The `order` CSS property sets the order in which a flex item appears within the flex container.

## How do I change the visual order of flex items with CSS order?

The property used in flexbox layouts to specify the order in which flex items appear in the container. By setting the `order` property, the visual order of items can be changed without altering their source order, allowing for flexible layouts.

- Topic: Flexboxes
- Type: property
- Browser support: Chrome 29+, Chrome Android 29+, Edge 12+, Firefox 20+, Firefox Android 20+, Safari 9+, Safari iOS 9+

## Example

Wrong:

```css
.first {
  order: 1;
}
```

Right:

```css
.first {
  order: -1;
}
```

All items default to `order: 0`, so 1 moves an item to the end and -1 moves it to the start.

## Common mistakes

- Keyboard focus jumps around because `order` changed only the visual layout.

## Key points

- `order` is not used to fix content order that should change in the HTML, since Tab and screen readers follow the DOM.
- Items without `order` are treated as 0, so a value of -1 moves an item first.

## Interview questions

### Does order work in CSS grid?

Yes. `order` affects auto-placed items in both flex and grid containers.

### Is CSS order bad for accessibility?

It can be. It breaks WCAG meaningful sequence when the visual order differs from the DOM order in a way that changes meaning.

## Related cards

- [flex](https://wonderium.dev/css/flex.md)
- [grid-auto-flow](https://wonderium.dev/css/grid-auto-flow.md)
- [flex-direction](https://wonderium.dev/css/flex-direction.md)
- [WCAG](https://wonderium.dev/a11y/wcag.md)
- [\[tabindex\]](https://wonderium.dev/html/tabindex.md)

---

- Level: [CSS](https://wonderium.dev/css.md)
- HTML version: https://wonderium.dev/css/order
- Last updated: 2026-11-25
