Welcome to the Treehouse Community
Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.
Looking to learn something new?
Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.
Start your free trialJuan Francisco Andrade Álvarez
23,997 PointsHow can a last implicit row have a different height?
This workspace https://w.trhou.se/z74zcrghf8 is a css grid example that contains several photo cards (items). Let's imagine that these items are created dynamically by any server side logic. The last item in the grid container is a div element defined as a footer for that grid, which also contains a button that has to be center aligned inside its parent. By the grid definition, the footer takes the height of the implicit row: 200px. The footer element spans 3 columns of the grid. How can the footer have a smaller size than the grid-auto-rows property, defined on the grid container?
Note. Refer to index.html and css/grid.css to see the code. The example can be seen live here: https://w.trhou.se/z74zcrghf8
Thanks for the help.
1 Answer
darryn
17,367 PointsHi Juan,
You already targeted it in your CSS. Can't you just set the height there?
.photos-footer {
background-color: lightgreen;
grid-column: 1 / 3;
height: 50px; /* make it a smaller height */
}
Or by dynamic do you mean some unknown number of objects will be sent by the server? In that case, how about this?
.photos:last-child { /* target the last grid item */
background-color: lightgreen;
grid-column: 1 / 3;
height: 50px; /* make it a smaller height */
}