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

# row-gap (grid-row-gap)

APISummary
## 介绍

`row-gap`/`grid-row-gap` 属性用来设置[弹性布局](/next/zh/guide/ui/layout/flexible-box-layout.md)和[网格布局](/next/zh/guide/ui/layout/grid-layout.md)行元件之间的间隙（gutter）大小。

为了兼容性，可使用 `row-gap` 或 `grid-row-gap`。

## 使用示例

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

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

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

const RowGap = () => {
  const flexContainerStyle = {
    display: "flex" as const,
    flexWrap: "wrap" as const,
    rowGap: "15px",
    margin: "10px",
    border: "1px solid #000",
    borderRadius: "4px",
    marginBottom: "100rpx" as const,
  };

  const gridContainerStyle = {
    display: "grid" as const,
    rowGap: "10px",
    gridTemplateColumns: "1fr 1fr 1fr",
    margin: "10px",
    padding: "5px",
    border: "1px solid #000",
    borderRadius: "4px",
  };

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

  return (
    <>
      <text style={titleStyle}>using row-gap in flex layout</text>
      <view style={flexContainerStyle}>
        <text className="item">ONE</text>
        <text className="item">TWO</text>
        <text className="item">THREE</text>
        <text className="item">FOUR</text>
        <text className="item">FIVE</text>
        <text className="item">SIX</text>
        <text className="item">SEVEN</text>
        <text className="item">EIGHT</text>
        <text className="item">NINE</text>
        <text className="item">TEN</text>
      </view>

      <text style={titleStyle}>using row-gap in grid layout</text>
      <view style={gridContainerStyle}>
        <text className="item2">ONE</text>
        <text className="item2">TWO</text>
        <text className="item2">THREE</text>
        <text className="item2">FOUR</text>
        <text className="item2">FIVE</text>
        <text className="item2">SIX</text>
        <text className="item2">SEVEN</text>
        <text className="item2">EIGHT</text>
        <text className="item2">NINE</text>
        <text className="item2">TEN</text>
      </view>
    </>
  );
};

root.render(<RowGap />);

```

v0.11.0



## 取值

### `<length>`

[`<length>`](/next/zh/api/css/data-type/length.md) 表示[弹性布局](/next/zh/guide/ui/layout/flexible-box-layout.md)或[网格布局](/next/zh/guide/ui/layout/grid-layout.md)行之间的间隙宽度。

### `<percentage>`

行之间直接的间隙宽度，[`<percentage>`](/next/zh/api/css/data-type/percentage.md) 相对容器自身 content area **纵向**大小的百分比。

## 形式语法

```
row-gap = <length-percentage [0,∞]>

<length-percentage> = <length> | <percentage>
```

## 语法

```css
/* <length> values */
row-gap: 20px;
grid-row-gap: 20px;
row-gap: 1em;
grid-row-gap: 1em;

/* <percentage> value */
row-gap: 10%;
grid-row-gap: 10%;

/* calc() values */
row-gap: calc(10% + 20px);
grid-row-gap: calc(10% + 20px);
```

## 形式定义

| 初始值 | `0` |
| 适用元素 | 弹性容器和网格容器 |
| 是否支持继承 | 否 |
| 是否支持动画 |  |
| 百分比 | refer to vertical dimension of its own content area |


## 与 Web 的区别

[mdn: row-gap](https://developer.mozilla.org/en-US/docs/Web/CSS/row-gap)

1. 不支持 `normal`。

## 兼容性

**Compatibility Table**

**Query:** `css.properties.row-gap`

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

| Feature | Android | HarmonyOS | iOS | macOS | Windows | Web |
| --- | --- | --- | --- | --- | --- | --- |
| row-gap | Yes (2.14) | Yes (3.4) | Yes (2.14) | Yes (2.14) | Yes (2.14) | Yes |
| grid-row-gap | Yes (2.1) | Unknown | Yes (2.1) | Yes (2.1) | Yes (2.1) | Yes |
| supported&#95;in&#95;flex&#95;layout | Yes (2.14) | Yes (3.4) | Yes (2.14) | Yes (2.14) | Yes (2.14) | Yes |
| supported&#95;in&#95;flex&#95;layout.nested&#95;value&#95;1 | Yes (2.14) | Yes (3.4) | Yes (2.14) | Yes (2.14) | Yes (2.14) | Yes |
| supported&#95;in&#95;grid&#95;layout | Yes (2.1) | Yes (3.4) | Yes (2.1) | Yes (2.1) | Yes (2.1) | Yes |
| supported&#95;in&#95;grid&#95;layout.grid-row-gap | Yes (2.1) | Yes (3.4) | Yes (2.1) | Yes (2.1) | Yes (2.1) | Yes |
| supported&#95;in&#95;grid&#95;layout.row-gap | Yes (2.14) | Yes (3.4) | Yes (2.14) | Yes (2.14) | Yes (2.14) | Yes |

**`row-gap`**

<code>row-gap</code>

**Specifications:**

**`grid-row-gap`**

<code>grid-row-gap</code>

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

**`supported_in_flex_layout`**

Supported in Flexible Box Layout

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

**`supported_in_flex_layout.nested_value_1`**

<code>row-gap</code> and <code>grid-row-gap</code>

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

**`supported_in_grid_layout`**

Supported in Grid Layout

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

**`supported_in_grid_layout.grid-row-gap`**

<code>grid-row-gap</code>

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

**`supported_in_grid_layout.row-gap`**

<code>row-gap</code>

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

