order

Changes the visual order of items within a flex or grid container without changing their actual order in the HTML code.

Quick example

.sticky-nav {
  order: 999;
} /* moves the nav to the end of the flex container */

Syntax

order: <integer>
0
Default. Items follow the source order of the HTML.
<positive integer>
Item moves after items with lower order values. order: 1 pushes the item to the end of items with order: 0.
<negative integer>
Item moves before items with higher order values. order: -1 pulls an item to the start.

Quick facts

Initial value
0
Inherited
No
Applies to
Flex items, grid items, and absolutely positioned children of flex and grid containers
Animation type
integer

Examples

Move one item to the end

.nav {
  display: flex;
}

.nav .logout {
  order: 1;
}

Everything else has the default order of 0. The logout link has 1, so it appears last regardless of where it sits in the HTML.

Pull an item to the front

.cards .featured {
  order: -1;
}

Featured card appears first visually. Useful when content order is fixed by a CMS but visual priority needs to differ.

Reorder groups of items

.items .primary { order: 1; }
.items .secondary { order: 2; }
.items .tertiary { order: 3; }

Group items into visual tiers. All primary items come first, then secondary, then tertiary, regardless of HTML order.

order Browser Support

Widely available Since 2015 96% global usage

This feature is well established and works across many devices and browser versions. It has been available across browsers since 2015.

Safe to use without fallbacks.

29+
20+
9+
12+

Common pitfalls

order does not change keyboard or screen reader order

order only affects visual layout. Tab order, screen reader reading order, and focus flow still follow the HTML source. Heavy use of order creates a confusing experience for keyboard and assistive technology users. Only reorder when visual and reading order can diverge without harm.

order only works inside flex or grid containers

order has no effect on regular block or inline elements. The parent must have display: flex or display: grid.

Items with the same order use source order

When multiple items share the same order value, they fall back to HTML document order between them. Two items with order: 1 keep their relative HTML sequence.

See also

ESC