{"id":366810,"date":"2022-07-15T06:16:52","date_gmt":"2022-07-15T13:16:52","guid":{"rendered":"https:\/\/css-tricks.com\/?page_id=366810"},"modified":"2022-08-26T08:25:55","modified_gmt":"2022-08-26T15:25:55","slug":"grid-auto-rows","status":"publish","type":"page","link":"https:\/\/css-tricks.com\/almanac\/properties\/g\/grid-auto-rows\/","title":{"rendered":"grid-auto-rows"},"content":{"rendered":"\n
The That example creates a grid container with two rows defined by As said above, Here are some situations where that might come up.<\/p>\n\n\n The first case is the one that we saw at the top of this article. A grid can have an explicit row defined by The first row is set to grid-auto-rows<\/code> CSS property is part of the CSS Grid Layout specification<\/a>, specifying the size of the grid
rows<\/code> that were created without having an explicit size. In other words, this property sets the size of implicit rows<\/a> and any other rows that have not been explicitly sized in the
grid-template-rows<\/code><\/a> property.<\/p>\n\n\n\n\n\n\n\n
.grid-container {\n display: grid;\n grid-template-areas: \"media detail detail\"\n \"media detail detail\";\n grid-template-rows: 200px;\n grid-auto-rows: 150px;\n}<\/code><\/pre>\n\n\n\n
grid-template-areas<\/code>. The first row has an explicit size set by
grid-template-rows<\/code>, but not the second row. This is where
grid-auto-rows<\/code> kicks in and sets that row\u2019s size to
150px<\/code>.<\/p>\n\n\n
grid-auto-rows<\/code> use cases<\/h3>\n\n\n
grid-auto-rows<\/code> sets the size of any rows that don\u2019t have an explicit size. Now the question is, what kind of rows don\u2019t have an explicit size? Or, how does a grid create rows without an explicit size?<\/p>\n\n\n\n
Rows that are defined by
grid-template-areas<\/code> that have no explicit size set by
grid-template-rows<\/code><\/h4>\n\n\n
grid-template-areas<\/code> without having its size set explicitly by the
grid-template-rows<\/code> property.<\/p>\n\n\n\n
.grid-container {\n display: grid;\n grid-template-areas: \"media detail detail\"\n \"media detail detail\"; \/* 2 rows *\/\n grid-template-rows: 200px; \/* 1 size *\/\n}<\/code><\/pre>\n\n\n\n
200px<\/code>, and since the last row is not set to any explicit size, it will be set to
auto<\/code>. In this example the second row does not have any content therefore
auto<\/code> is equal to zero size.<\/p>\n\n\n\n