# Max Height

## Introduction

The `Max Height` variable sets the maximum height in pixels. This value is applied after all other layout so it can be used to overwrite automatically-assigned height.

By default this value is `<NULL>` which means there is no `Max Height`.

<figure><img src="/files/ygByc6GpZzkJqytsAPFZ" alt=""><figcaption><p>A ColoredRectangle with no <code>Max Height</code></p></figcaption></figure>

If `Max Height` is assigned (not `<NULL>`), then the effective height cannot be larger than the `Max Height` value. The following animation shows that height is limited to a `Max Height` of `100`.

<figure><img src="/files/Q7UngbU4O0R2kjCIztX4" alt=""><figcaption><p><code>Max Height</code> set to <code>100</code> limits the ColoredRectangle's height</p></figcaption></figure>

Notice that the `Height` variable can still be set to a value larger than the `Max Height`, but it does not apply visually.

`Max Height` can also be used if `Height Units` is set to values other than `Absolute`. For example, `Max Height` can be used to limit the height of a ColoredRectangle when `Height Units` is `Relative to Parent`.

<figure><img src="/files/IMvVdzVA4c1ZCkzhSZHs" alt=""><figcaption><p>Rectangle's height limited by its <code>Max Height</code> of <code>100</code></p></figcaption></figure>

## Max Height and Relative to Children

Note that Max Height can prevent a container from growing according to its children. For more information, see the [Relative to Children Height Units page](/gum/gum-tool/gum-elements/general-properties/height-units.md#relative-to-children).


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.flatredball.com/gum/gum-tool/gum-elements/general-properties/max-height.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
