Skip to main content

parse_grid_tracks

Function parse_grid_tracks 

Source
pub fn parse_grid_tracks(value: &str) -> Vec<GridTrack>
Expand description

Parses a CSS grid-template-columns or grid-template-rows track list.

Accepted track forms are auto, min-content, max-content, fit-content(<length>), unitless 0, <n>px, <n>%, and <n>fr. Square-bracket line names such as [content-start] are stripped from the token stream.

repeat(<count>, <track list>) expands the inner list <count> times. repeat(auto-fill, ...) and repeat(auto-fit, ...) expand the inner list exactly once because intrinsic repetition needs a layout pass; the tracks are not duplicated to fill the container.

minmax(<min>, <max>) is reduced to a single track: a 1fr maximum or a 0/auto minimum becomes 1fr, a fixed minimum paired with an auto maximum keeps the minimum, and every other combination keeps the maximum track. Full minimum and maximum track sizing is deferred to the grid solver.