pub enum Length {
Px(f32),
Em(f32),
Rem(f32),
Percent(f32),
Vw(f32),
Vh(f32),
Vmin(f32),
Vmax(f32),
Fr(f32),
Token(Spacing),
Auto,
MaxContent,
}Expand description
A length in abstract units, CSS-style.
Everything resolves to logical units (points on macOS, effective pixels on Windows, logical pixels on GTK), so layouts are DPI-independent.
Variants§
Px(f32)
Logical pixels.
Em(f32)
Multiple of the node’s inherited font size.
Rem(f32)
Multiple of the platform body font size (follows the user’s text size setting).
Percent(f32)
Percentage (0–100) of the containing block.
Vw(f32)
Percentage of the window content width.
Vh(f32)
Percentage of the window content height.
Vmin(f32)
Vmax(f32)
Fr(f32)
Fraction of the free space. Grid tracks only; elsewhere it acts as Auto.
Token(Spacing)
A platform spacing token.
Auto
MaxContent
The node’s natural size: what it measures with no limit, as CSS’s
max-content. For the least and most sizes of a measured node (a
list, as high as its rows; a label, its one line), so a list that
grows from nothing stops at its rows. Elsewhere it acts as Auto.