Variant or constructor | Meaning |
|---|---|
Length::points(x) | Fixed logical points. |
Length::percent(x) | Percentage of the containing axis. 50.0 means 50%. |
Length::vw(x) | Percentage of active viewport width. |
Length::vh(x) | Percentage of active viewport height. |
Length::clamp(min, preferred, max) | Preferred value bounded by min and max. |
Length::min(values) | Smallest resolved value. |
Length::max(values) | Largest resolved value. |
Length::fit_content(limit) | Intrinsic content size, optionally capped. |
Length::MinContent | Minimum intrinsic content size. |
Length::MaxContent | Preferred intrinsic content size. |
Length::Auto | Let the active layout algorithm choose. |
const PROFILE_MIN_WIDTH: f32 = 280.0;
const PROFILE_MAX_WIDTH: f32 = 480.0;
Container::new(ProfileCard)
.width_length(Length::clamp(
Length::points(PROFILE_MIN_WIDTH),
Length::percent(36.0),
Length::points(PROFILE_MAX_WIDTH),
))
.into()