FAQ: CSS Grid Essentials - Grid Gap

This community-built FAQ covers the “Grid Gap” exercise from the lesson “CSS Grid Essentials”.

Paths and Courses
This exercise can be found in the following Codecademy content:

Learn CSS

FAQs on the exercise Grid Gap

There are currently no frequently asked questions associated with this exercise – that’s where you come in! You can contribute to this section by offering your own questions, answers, or clarifications on this exercise. Ask or answer a question by clicking reply (reply) below.

If you’ve had an “aha” moment about the concepts, formatting, syntax, or anything else with this exercise, consider sharing those insights! Teaching others and answering their questions is one of the best ways to learn and stay sharp.

Join the Discussion. Help a fellow learner on their journey.

Ask or answer a question about this exercise by clicking reply (reply) below!

Agree with a comment or answer? Like (like) to up-vote the contribution!

Need broader help or resources? Head here.

Looking for motivation to keep learning? Join our wider discussions.

Learn more about how to use this guide.

Found a bug? Report it!

Have a question about your account or billing? Reach out to our customer support team!

None of the above? Find out where to ask other questions here!

Can GRID-GAP be also applied to rows/columns fixed by %s or px? If so, how?

why is row-gap and gap colored orange whereas column-gap is not?

2 Likes

Yes we can use either %, px, rem or em

What does “Comment Out the Row-gap and grid-gap declarations” mean?

I can see by commenting / / I “turn off” the declaration (or so the colour of the font would have me believe) but I can’t see what I need to do to trigger the exercise being complete…

This is what I’ve tried. I gather I’m supposed to “turn off” the row-gap and column-gap and leave it in as an explanatory comment (as just removing altogether does not pass the lesson).

EDIT: Fixed - needs to be totally outside of the declaration:

I think it might be an ordering issue…? Mine reads as below and it was allowed:

grid {
display: grid;
border: 2px blue solid;
height: 500px;
grid-template: repeat(3, 1fr) / 3fr minmax(50px, 300px) 1fr;
/row-gap: 20px;
column-gap: 5px;
/
gap: 20px 5px;
}

yh I was thinking the same too, a bug maybe

1 Like

What is the purpose of commenting out an element ? as we comment out the row-gap and column- gap. I totally dont know about commenting.

Gap is valid CSS for setting the gap between rows and columns

When completing quizzes for CSS grid, it’s still outdated and doesn’t accept gap as correct. grid-gap is outdated and only for older browsers now.

From MDN:
https://developer.mozilla.org/en-US/docs/Web/CSS/gap

The gap CSS shorthand property sets the gaps (gutters) between rows and columns.
Early versions of the specification called this property grid-gap, and to maintain compatibility with legacy websites, browsers will still accept grid-gap as an alias for gap.

Just an FYI for those of you thinking grid-gap is the most recent property. Codecademy obviously don’t have time to keep their content updated!