Skip to main content

fit-to-height

Fit content to specified height.

Example: #utils.fit-to-height(100%)[BIG]

Parameters

width : length | fraction | relative    default: none

Will determine the width of the content after scaling. So, if you want the scaled content to fill half of the slide width, you can use width: 50%.

prescale-width : length | fraction | relative    default: none

Allows you to make Typst's layout assume that the given content is to be laid out in a container of a certain width before scaling. For example, you can use prescale-width: 200% assuming the slide's width is twice the original.

grow : bool    default: true

Indicates whether the content should be scaled up if it is smaller than the available height. Default is true.

shrink : bool    default: true

Indicates whether the content should be scaled down if it is larger than the available height. Default is true.

height : length

The height to fit the content to.

body : content

The content to fit.

Returns: content