Jul 30, 2025
This lecture covers the CSS property grid-template-columns, which defines column sizing and line names in a CSS grid layout.
grid-template-columns sets the line names and track sizing functions for columns in a CSS grid container.grid-template-columns: 1fr 60px; or grid-template-columns: 100px 1fr;.px, em), percentage (%), flexible fraction (fr), and keywords (auto, max-content, min-content).[start] 100px [middle] 1fr [end].minmax(min, max): sets a size range for a column.fit-content(length/percentage): clamps the column to content but limits its max size.repeat(n, value): repeats a pattern n times or uses auto-fill/auto-fit for dynamic layouts.subgrid: inherits grid lines from the parent grid.masonry: experimental masonry-style layout.grid-template-columns: 50px 1fr; creates two columns, the first fixed at 50px, the second taking the remaining space.grid-template-columns: [col1] 100px [col2] 1fr [col3]; allows naming grid lines for item placement.none means columns are not explicitly defined; columns will use grid-auto-columns size.fr unit divides leftover space proportionally.auto can be minimum or maximum depending on context, often behaves like min-content for min and max-content for max.grid-template-columns values using px, fr, auto, minmax(), and repeat().auto-fill and subgrid.grid-template-rows, grid-template-areas, and grid-template.