> 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.

# deprecated grid-row-span

APISummary
:::warning
该 API 已被废弃。
:::

## 介绍

在[网格布局](/next/zh/guide/ui/layout/grid-layout.md)中，指定网格项目的行跨度。用于简化开发，W3C 没有这个属性。此属性是子元件属性。

## 使用示例

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

**Entry:** `src/grid-row-span`
**Bundle:** `dist/grid-row-span.lynx.bundle`

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

const GridRowSpan = () => {
  const titleStyle = {
    fontSize: "45rpx" as const,
    fontWeight: "900" as const,
    alignSelf: "center" as const,
    color: "linear-gradient(to right, rgb(255,53,26), rgb(0,235,235))" as const,
  };

  return (
    <>
      <text style={titleStyle}>grid-row-span: 1</text>
      <view className="container">
        <text
          className="item"
          style={{
            backgroundColor: "rgb(255,53,26)",
            // @ts-expect-error TODO(types): Support gridRowSpan in `@lynx-js/types`
            gridRowSpan: "1",
          }}
        >
          ONE
        </text>
        <text className="item">TWO</text>
        <text className="item">THREE</text>
      </view>

      <text style={titleStyle}>grid-row-span: 2</text>
      <view className="container">
        <text
          className="item"
          style={{
            backgroundColor: "rgb(255,53,26)",
            // @ts-expect-error TODO(types): Support gridRowSpan in `@lynx-js/types`
            gridRowSpan: "2",
          }}
        >
          ONE
        </text>
        <text className="item">TWO</text>
        <text className="item">THREE</text>
      </view>

      <text style={titleStyle}>grid-row-span: 3</text>
      <view className="container">
        <text
          className="item"
          style={{
            backgroundColor: "rgb(255,53,26)",
            // @ts-expect-error TODO(types): Support gridRowSpan in `@lynx-js/types`
            gridRowSpan: "3",
          }}
        >
          ONE
        </text>
        <text className="item">TWO</text>
        <text className="item">THREE</text>
      </view>
    </>
  );
};

root.render(<GridRowSpan />);

```

v0.11.0



## 语法

```css
/* <number> values */
grid-row-span: 1;
grid-row-span: 2;
```

### 取值

- `<number>`

  [`<number>`](/next/zh/api/css/data-type/number.md) 整数数字，表示网格项目在行方向上的跨度。暂不支持负数。

## 形式定义

| 初始值 | `1` |
| 适用元素 | grid items |
| 是否支持继承 | 否 |
| 是否支持动画 |  |


## 形式语法

```
grid-row-span = <number>
```

## 与 Web 的区别

- Web 没有这个属性。

## 注意事项

- 当 [`grid-row-start`](/next/zh/api/css/properties/grid-row-start.md) 和 [`grid-row-end`](/next/zh/api/css/properties/grid-row-end.md) 指定了两个不同的具体网格线位置时，行跨度由两条网格线之间的距离决定，`grid-row-span` 不再生效。下面的网格项目占 3 行：

  ```css
  grid-row-start: 2;
  grid-row-end: 5;
  grid-row-span: 1;
  ```

- 不要将 `grid-row-span` 与 `grid-row-start` 或 `grid-row-end` 中的 `span <number>` 混用。它们都会指定行跨度，并可能相互覆盖。下面的声明同时指定了 3 行和 1 行这两个冲突的跨度：

  ```css
  grid-row-start: 2;
  grid-row-end: span 3;
  grid-row-span: 1;
  ```

## 兼容性

**Compatibility Table**

**Query:** `css.properties.grid-row-span`

[Source](https://github.com/lynx-family/lynx/blob/develop/tools/css_generator/css_defines/176-grid-row-span.json)

| Feature | Android | HarmonyOS | iOS | macOS | Windows | Web |
| --- | --- | --- | --- | --- | --- | --- |
| grid-row-span | Yes (2.1) | Yes (3.4) | Yes (2.1) | Yes (2.1) | Yes (2.1) | No |

**`grid-row-span`**

**Specifications:**

- **Web — Not supported:** Use the standard grid-column or grid-row span syntax; this native property is not translated by Web Lynx.

