Understanding grid-template-rows in CSS Grid
The grid-template-rows property in CSS Grid defines the number, size, and height of the rows in a grid container. It sets up the horizontal tracks along which grid items are placed.
Defines the number of rows in the grid.
Specifies the height of each row using lengths (px, em), percentages (%), fractions (fr), or auto.
Supports the repeat() function for repeating rows with the same size.
Works in combination with grid-template-columns to define the full grid structure.
Example: grid-template-rows: 100px auto 50px; creates three rows with fixed, auto, and fixed heights.
We need a simple card component where the image should always be 150px tall and the text below should fill the remaining space. How would you use grid-template-rows to achieve that?
If a container has grid-template-rows: 100px auto; and three rows of content, what heights will the rows have when the middle row's content exceeds 200px?
Write the CSS to create a two‑row layout where the first row occupies 30% of the viewport height and the second row takes the rest, using grid-template-rows.
After adding a new promotional banner, the second row of our product page collapsed. The grid uses grid-template-rows: min-content 1fr. Why did this happen and how would you fix it?
We want a dashboard with three rows sized 200px, 1fr, and 2fr on desktop, but equal heights on mobile. How would you implement that using grid-template-rows and media queries?
A teammate changed grid-template-rows to repeat(2, 1fr) and now the header row shrinks unexpectedly. What could cause that and how would you debug the issue?
Design a reusable Grid component for a data table that supports variable row heights, optional fixed header/footer rows, and can handle thousands of rows efficiently. Discuss your grid-template-rows strategy and any performance considerations.
Our legacy UI mixes Flexbox and Grid. We need to refactor a complex form layout to use Grid exclusively while supporting dynamic field groups. How would you structure grid-template-rows to keep the CSS maintainable?
When implementing virtual scrolling inside a grid container, how does choosing fixed versus flexible values in grid-template-rows affect scroll calculations and rendering performance?
Our organization is migrating to a design system that relies heavily on CSS Grid. What guidelines would you establish for using grid-template-rows across teams to ensure consistency, theming, and future scalability?
Many micro‑frontends currently hard‑code pixel values in grid-template-rows, causing breakage on new devices. Propose an architectural strategy—using CSS variables, design tokens, etc.—to standardize row sizing and describe how you’d roll it out.
During a cross‑team redesign we need to support both LTR and RTL languages while using grid-template-rows for vertical spacing. What patterns and considerations would you adopt to avoid duplication and maintain accessibility?