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

# min-height

APISummary
## 介绍

设置元件的最小高度。它可以阻止 [`height`](/next/zh/api/css/properties/height.md) 属性的应用值小于 `min-height` 的值。
`min-height` 的值会覆盖 [`height`](/next/zh/api/css/properties/height.md)，但是会被 [`max-height`](/next/zh/api/css/properties/max-height.md) 覆盖。

## 使用示例

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

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

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

const MinHeight = () => {
  const containerStyle = {
    display: "linear" as const,
    linearDirection: "row" as const,
  };

  const firstBoxStyle = {
    height: "300px",
    backgroundColor: "green",
    width: "100px",
  };

  const secondBoxStyle = {
    height: "0px",
    backgroundColor: "yellow",
    width: "100px",
    minHeight: "300px",
  };

  const thirdBoxStyle = {
    height: "0px",
    backgroundColor: "blue",
    width: "100px",
    minHeight: "300px",
    maxHeight: "200px",
  };

  return (
    <view className="intro" style={containerStyle}>
      <view style={firstBoxStyle}>
        <text>height: 300px</text>
      </view>
      <view style={secondBoxStyle}>
        <text>height: 0px; min-height: 300px</text>
      </view>
      <view style={thirdBoxStyle}>
        <text>height: 0px; min-height: 300px; max-height: 200px</text>
      </view>
    </view>
  );
};

root.render(<MinHeight />);

```

v0.11.0



## 语法

```css
/* <length> */
min-height: 120px;
min-height: 10em;

/* <percentage> */
min-height: 75%;
```

### 取值

#### `<length>`

[`<length>`](/next/zh/api/css/data-type/length.md) 定义了一个确定值。默认值为 `0px`。

#### `<percentage>`

定义 `min-height` 为一个相对于父容器高度的百分数。

## 形式定义

| 初始值 | 0px |
| 适用元素 | 所有元件 |
| 是否支持继承 | 否 |
| 是否支持动画 | yes |
| 百分比 | The percentage is calculated with respect to the height of the generated box's containing block |


## 形式语法

```
min-height = <length-percentage [0,∞]>

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

## 与 Web 的区别

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

1. 不支持 `auto`，默认值是 `0px`。
2. 不支持 `none`，`max-content`，`min-content`，`fit-content`。
3. 在 Lynx 中 `min-height` 不会覆盖 `max-height`。
4. 在 Lynx 中，如果指定的 `max-height` 小于 `min-height`，则 `min-height` 会被忽略。

## 兼容性

**Compatibility Table**

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

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

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

**`min-height`**

sets the minimum height of an element.

**Specifications:**

