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

# `<max-content>`

APISummary
`max-content` 目前支持在 [`width`]、[`height`] 和[网格布局]（grid）属性 ([`grid-template-columns`]、[`grid-template-rows`]、[`grid-auto-columns`]、[`grid-auto-rows`]) 中使用。

## 示例

```css
width: max-content;
grid-template-columns: max-content;
grid-template-rows: max-content;
grid-auto-columns: max-content;
grid-auto-rows: max-content;
```

## 兼容性

**Compatibility Table**

**Query:** `css.data-type.max-content`

[Source](https://github.com/lynx-family/lynx-website/tree/main/packages/lynx-compat-data/css/data-type/max-content.json)

| Feature | Android | HarmonyOS | iOS | macOS | Windows | Web |
| --- | --- | --- | --- | --- | --- | --- |
| max-content | Yes (targetSdkVersion 2.0) | Yes (3.4) | Yes (targetSdkVersion 2.0) | No | No | Yes |

**`max-content`**

<code>&lt;max-content&gt;</code>

**Specifications:**
- [https://drafts.csswg.org/css-sizing-3/#valdef-width-max-content](https://drafts.csswg.org/css-sizing-3/#valdef-width-max-content)


[`width`]: /next/zh/api/css/properties/width.md

[`height`]: /next/zh/api/css/properties/height.md

[`grid-template-columns`]: /next/zh/api/css/properties/grid-template-columns.md

[`grid-template-rows`]: /next/zh/api/css/properties/grid-template-rows.md

[`grid-auto-columns`]: /next/zh/api/css/properties/grid-auto-columns.md

[`grid-auto-rows`]: /next/zh/api/css/properties/grid-auto-columns.md

[网格布局]: /next/zh/guide/ui/layout/grid-layout.md
