It’s beautifully straightforward to add a gutter to our grid layout. Let’s apply one with grid-gap
.
[00:01] In our mockup, we have 10 grid items within a container and our container is a grid. It's taking up all of the available height and it has three grid template columns. There's not space between any of the columns or the rows at the moment, so if we wanted to apply gutter to our grid we could do so with grid gap.
[00:24] Using grid gap like this is actually shorthand for both the row and the column gaps. If we look under the hood here, there's our shorthand being applied. If we wanted different values for the rows and columns we could pass separate values.
[00:43] Now, we have grid row gap of 10 pixels and grid column gap of 100 pixels. If we don't specify a second argument, grid column gap will be the same as grid row gap. Of course, if we wanted to we could specify grid row gap and grid column gap without using shorthand.
[01:00] Using grid gap, our gutter only applies to within the grid. If we wanted it on the outside as well, we could just use margin.
I see when you added margin to your
100vh
grid, a scroll bar was created. Looks like this would happen with padding as well. Would you say this snippet below would be a good solution to remove that scroll bar (assuming a vertical margin of 10px like in your video)?height:calc(100vh - 20px)