Join egghead, unlock knowledge.

Want more egghead?

This lesson is for members. Join us? Get access to all 3,000+ tutorials + a community with expert developers around the world.

Unlock This Lesson
Become a member
to unlock all features

Level Up!

Access all courses & lessons on egghead today and lock-in your price for life.


    Specify a grid gutter size with grid-gap


    It’s beautifully straightforward to add a gutter to our grid layout. Let’s apply one with grid-gap.



    Become a Member to view code

    You must be a Pro Member to view code

    Access all courses and lessons, track your progress, gain confidence and expertise.

    Become a Member
    and unlock code for this lesson
    orLog In




    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.

    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.

    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.

    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.