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

# line-height

APISummary
## 介绍

`line-height` 属性用于设置多行文本的间距。

## 使用示例

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

**Entry:** `src/line-height`
**Bundle:** `dist/line-height.lynx.bundle`

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

const LineHeight = () => {
  const containerStyle = {
    width: "100%",
    height: "100%",
    flexDirection: "column" as const,
  };

  const text1Style = {
    lineHeight: "30px",
  };

  const text2Style = {
    fontSize: "16px",
    lineHeight: "3",
  };

  const text3Style = {
    fontSize: "16px",
    lineHeight: "50px",
  };

  const inlineText1Style = {
    fontSize: "30px",
  };

  const inlineText2Style = {
    fontSize: "40px",
  };

  return (
    <scroll-view className="root" scroll-orientation="vertical">
      <view className="fixed_area">
        <view style={containerStyle}>
          <text className="item" style={text1Style}>XX{"\n"}XX{"\n"}XX</text>
          <text className="item" style={text2Style}>XX{"\n"}XX{"\n"}XX</text>
          <text className="item" style={text3Style}>
            XX
            <text style={inlineText1Style}>XX</text>
            <text style={inlineText2Style}>XX</text>
          </text>
        </view>
      </view>
    </scroll-view>
  );
};

root.render(<LineHeight />);

```

v0.11.0



## 语法

```css
line-height: normal;

/* Unitless values: use this number multiplied
by the element's font size */
line-height: 3.5;
```

### 取值

- normal 

  默认值。

- [`<number>`](/next/zh/api/css/data-type/number.md) 

  无单位的数字，表示行高为该数字乘以该元件的字体大小 ([`font-size`](/next/zh/api/css/properties/font-size.md))。

- [`<length>`](/next/zh/api/css/data-type/length.md) 

  指定行高的具体数值。

## 形式定义

| 初始值 | normal |
| 适用元素 | text |
| 是否支持继承 | yes |
| 是否支持动画 | no |


## 形式语法

```
normal | <length> | <number>
```

## 与 Web 的区别

- `line-height` 属性只影响 `<text>` 元件，设置在其他标签上不会生效。

## 注意事项

- `line-height` 的值最好大于 `font-size` 的值，否则文本上下可能会被截断。

- `line-height` 属于段落属性，不会作用于 inline text 上。

## 兼容性

**Compatibility Table**

**Query:** `css.properties.line-height`

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

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

**`line-height`**

**Specifications:**

