> For AI agents: the complete documentation index is available at /next/zh/llms.txt, the full documentation bundle is available at /next/zh/llms-full.txt.

# order

APISummary
## 介绍

`order` 属性规定了容器中的子元件在布局时的顺序。元件按照 `order` 属性的值的增序进行布局。拥有相同 `order` 属性值的元件按照它们在源代码中出现的顺序进行布局。

## 使用示例

**下面是一个示例: css-api**

**Entry:** `src/order`
**Bundle:** `dist/order.lynx.bundle`

```tsx
import { root } from "@lynx-js/react";
import "./index.scss";

const Order = () => {
  const containerStyle = {
    display: "linear" as const,
  };

  const getOrderStyle = (order: number) => ({
    order: order,
  });

  return (
    <view className="intro" style={containerStyle}>
      <text className="intro-item" style={getOrderStyle(1)}>order: 1</text>
      <text className="intro-item" style={getOrderStyle(3)}>order: 3</text>
      <text className="intro-item" style={getOrderStyle(2)}>first order: 2</text>
      <text className="intro-item" style={getOrderStyle(2)}>second order: 2</text>
    </view>
  );
};

root.render(<Order />);

```

v0.11.0



## 语法

```css
/* Numerical value including negative numbers */
order: 5;
order: -5;
```

### 取值

- `<number>`

[`<number>`](/next/zh/api/css/data-type/number.md) 表示子元件所在的次序组。**默认值**为 `0`。

## 形式定义

| 初始值 | 0 |
| 适用元素 | 所有非[`position: absolute/fixed/sticky`](/next/api/css/properties/position)孩子元件 |
| 是否支持继承 | 否 |
| 是否支持动画 | no |


## 与 Web 的区别

1. 不支持在 [`position: absolute/fixed/sticky`](/next/zh/api/css/properties/position.md) flex and grid container children 上使用。
2. Lynx 中 `order` 的使用不会影响元件的渲染顺序，而 Web 会。

## 兼容性

**Compatibility Table**

**Query:** `css.properties.order`

[Source](https://github.com/lynx-family/lynx/blob/develop/tools/css_generator/css_defines/75-order.json) · [MDN](https://developer.mozilla.org/zh-CN/docs/Web/CSS/order)

| Feature | Android | HarmonyOS | iOS | macOS | Windows | Web |
| --- | --- | --- | --- | --- | --- | --- |
| order | Yes (1.0) | Yes (3.4) | Yes (1.0) | Yes (1.0) | Yes (1.0) | Yes |

**`order`**

The order CSS property sets the order to lay out an item.

**Specifications:**

