percent

Function percent 

Source
pub fn percent<T>(value: T) -> Val
where T: ValNum,
Expand description

Returns a Val::Percent representing a percentage of the parent node’s length along a specific axis.

If the UI node has no parent, the percentage is based on the window’s length along that axis.

Axis rules:

  • For flex_basis, the percentage is relative to the main-axis length determined by the flex_direction.
  • For gap, min_size, size, and max_size:
    • width is relative to the parent’s width.
    • height is relative to the parent’s height.
  • For margin, padding, and border values: the percentage is relative to the parent’s width.
  • For positions, left and right are relative to the parent’s width, while bottom and top are relative to the parent’s height.