order
Example
.first {
order: 1;
}.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
orderchanged only the visual layout.
Key points
orderis not used to fix content order that should change in the HTML, since Tab and screen readers follow the DOM.- Items without
orderare 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.