Knowledge baseExam Center
ENEnglish
Choose language13

CKTIS / CSS

order — visual ordering of items

The order property orders flex and grid items using integer values. It changes visual layout without rearranging the DOM or, by itself, changing the default navigation sequence.

Version: CSS modules; structured CSSWG indexes reconciled with pinned MDN BCD; Chromium 152 scope gate, per-example verification still required

Syntax

order: <integer>;

order applies to flex and grid items. It accepts an integer, including negative values; its initial value is 0. It is not inherited and has no effect on ordinary elements outside these layouts.

Lower values are laid out earlier; equal values follow document order. This assigns groups, not specific position numbers. In the example, the expected left-to-right sequence is C B D A; B and D retain their relative order.

Use order only for spatial changes, not to repair logical content order. By itself, it does not change the DOM, speech order, or default Tab navigation. Keep the source logically ordered.

Examples

<!doctype html>
<html lang="en">
<meta charset="utf-8">
<title>order example</title>
<style>
  .items {
    display: flex;
    flex-direction: row;
    direction: ltr;
    writing-mode: horizontal-tb;
    gap: 16px;
  }
  .first { order: -1; }
  .last { order: 1; }
</style>
<div class="items">
  <span class="last">A</span>
  <span>B</span>
  <span class="first">C</span>
  <span>D</span>
</div>
</html>

Result

C B D A

The displayed code and declared result were verified in an isolated environment using the method recorded in the verification evidence for this exact version.

Sources