CSS Portal

CSS order Property

If this site has been useful, we’d love your support! Consider buying us a coffee to keep things going strong!

Description

The order property controls the visual ordering of items inside layout containers such as flex and grid without changing the underlying HTML source. It lets authors present items in a different sequence than they appear in the DOM, which can be useful for responsive rearrangements or for emphasizing particular items in a given viewport. Because it only affects items that participate in a layout mode, it only has effect when the container is set to a relevant mode like display that creates a flex or grid formatting context.

Using order interacts with the directional and placement rules of the layout system: the effective placement of an item is considered together with the container’s direction and flow settings, such as flex-direction for flexbox or grid-auto-flow for grid. Because the property changes where an item is painted rather than where it exists in the document tree, layout algorithms treat reordered items during the distribution of space, alignment, and wrapping, which can influence how other layout properties are applied.

Be cautious about accessibility and behavioral side effects when reordering visually. Screen readers, keyboard navigation and other user-agent behaviors typically follow document order rather than visual order, so relying on visual reordering alone can confuse sequential reading and focus order; when logical order matters, change the source order or provide appropriate accessibility markup instead. Also remember that reordering affects layout position only — stacking and overlap behaviors remain governed by stacking context rules and properties like z-index, so you may need to manage those separately if visual overlap is involved.

Definition

Initial value
0
Applies to
Flex items and absolutely-positioned flex container children
Inherited
No
Computed value
As specified
Animatable
Yes
JavaScript syntax
object.style.order

Interactive Demo

Box 1
Box 2
Box 3
Box 4
Box 5

Syntax

order: <integer>

Values

  • <integer>The value is any integer, including negative numbers and zero.

Example

<div class="container">
<div class="item item1">1 - order: 3</div>
<div class="item item2">2 - order: 1</div>
<div class="item item3">3 - order: 4</div>
<div class="item item4">4 - order: 2</div>
<div class="item item5">5 - order: 0</div>
</div>
.container {
  display: flex;
  gap: 12px;
  padding: 20px;
  background: #f5f7fa;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
}

.item {
  padding: 16px 20px;
  background: linear-gradient(135deg, #6cc1ff, #3b82f6);
  color: #fff;
  border-radius: 8px;
  font-weight: 600;
  min-width: 120px;
  text-align: center;
  box-shadow: 0 4px 8px rgba(11, 25, 40, 0.08);
}

.item1 { order: 3; }
.item2 { order: 1; }
.item3 { order: 4; }
.item4 { order: 2; }
.item5 { order: 0; }

Browser Support

The following information will show you the current browser support for the CSS order property. Hover over a browser icon to see the version that first introduced support for this CSS property.

This property is supported by all modern browsers.
Desktop
Chrome
Edge
Firefox
Opera
Safari
Tablets & Mobile
Chrome Android
Firefox Android
Opera Android
Safari iOS
Samsung Internet
Android WebView
-

Last updated by CSSPortal on: 1st January 2026

If this site has been useful, we’d love your support! Consider buying us a coffee to keep things going strong!