From the course: Responsive Layout

Unlock the full course today

Join today to access over 22,600 courses taught by industry experts or purchase this course individually.

Aligning grid items within tracks

Aligning grid items within tracks - HTML Tutorial

From the course: Responsive Layout

Start my 1-month free trial

Aligning grid items within tracks

- [Instructor] You can also align grid items within each row or column. This is done using the justify-items property. The default for this property which is stretch, with this each time takes up the full space of the cell it is in. So, in the code on line 13, I'm gonna add justify-items: stretch and save, refresh and nothing happens because that was already the default. So you can use start, end or center to align the items within the column. Changing this to start, save and refresh, start aligns them to be flush with the starting edge of the cell which is left in this case. So, you can see the width of the columns has not changed or the location of the columns has not changed, just the grid item within each cell has changed and put them at the start of that cell. Changing this to end and then refresh, they go to the ending edge of the cell. And then center and refresh, and they go to the center. We also have align-items which aligns grid items vertically, so it does essentially the…

Contents