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

# height

APISummary
## Introduction

The `height` CSS property specifies the height of an element. By default, the property defines the height of the border area. If [`box-sizing`](/next/api/css/properties/box-sizing.md) is set to `content-box`, however, it instead determines the height of the content area.

The [`min-height`](/next/api/css/properties/min-height.md) and [`max-height`](/next/api/css/properties/max-height.md) properties override `height`.

## Examples

**This is an example below: css-api**

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

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

const Height = () => {
  const scrollViewStyle = {
    height: "100%",
  };

  return (
    <scroll-view className="root" scroll-orientation="vertical" style={scrollViewStyle}>
      <view style={{ display: "linear", linearOrientation: "horizontal" }}>
        <text
          style={{
            height: "100px",
            border: "20px solid orange",
          }}
        >
          border-box
        </text>

        <text
          style={{
            height: "100px",
            border: "20px solid orange",
            boxSizing: "content-box",
          }}
        >
          content-box
        </text>
      </view>
    </scroll-view>
  );
};

root.render(<Height />);

```

v0.11.0



## Syntax

```css
/* <length> values */
height: 300px;
height: 25em;

/* <percentage> value */
height: 75%;

/* Keyword values */
height: max-content;
height: fit-content;
height: fit-content(20em);
height: auto;
```

### Values

- `auto`

  **Default value**. lynx will calculate and select a height for the specified element.

- `<length>`

  [`<length>`](/next/api/css/data-type/length.md) defines the height as a distance value.

- `<percentage>`

  Defines the height as a percentage of the [containing block](https://developer.mozilla.org/en-US/docs/Web/CSS/Containing_block)'s height.

- `max-content`

  The intrinsic preferred height.

- `fit-content`

  [`fit-content`](/next/api/css/data-type/fit-content.md) uses the computed size with the available space replaced by the specified argument.

## Formal definition

| Initial value | `auto` |
| Applies to | all elements |
| Inherited | no |
| Animatable | yes |
| Percentages | The percentage is calculated with respect to the height of the generated box's containing block |


## Formal syntax

```
height =
  auto                                      |
  <length-percentage [0,∞]>                 |
  max-content                               |
  fit-content( <length-percentage [0,∞]> )

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

## Differences from the Web

- By default, the property defines the height of the border area, while Web is `content area`.
- `min-content` is not supported.

## Compatibility

**Compatibility Table**

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

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

| Feature | Android | HarmonyOS | iOS | macOS | Windows | Web |
| --- | --- | --- | --- | --- | --- | --- |
| height | Yes (1.0) | Yes (3.4) | Yes (1.0) | Yes (1.0) | Yes (1.0) | Yes |
| max-content | Yes (1.6) | Yes (3.4) | Yes (1.6) | Yes (1.6) | Yes (1.6) | Yes |
| fit-content | Yes (2.0) | Yes (3.4) | Yes (2.0) | Yes (2.0) | Yes (2.0) | Yes |
| min-content | No | No | No | No | No | Yes |

**`height`**

**Specifications:**

**`max-content`**

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

**`fit-content`**

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

**`min-content`**

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

