Grid-row shorthand property

According to the 12th exercise in css grid [https://www.codecademy.com/courses/learn-intermediate-css/lessons/css-grid-essentials/exercises/grid-row]

When an item spans multiple rows or columns using these properties, it will also include the gap if any exists. For example, if an item spans two rows of height 100 pixels and there is a ten-pixel gap , then the item will have a total height of 210 pixels.

Can someone please explain what this mean? I did not get what they meant here.

Hi there,

As you read, you can use column-gap, row-gap, or the shorthand gap to create space between the rows and columns of your grid. This exercise is simply letting you know that when you span a row or column across a created gap, that gap amount is included in the total width or height of the item that spans.

From the example in the exercise, let’s see a visualization:
image

The grid has a row height of 100px and a gap of 10px. As you can see, item B spans both rows and its total height is 210px.
Row height + gap = item height

I hope this helps!

1 Like

Thank you, God bless you, your explanation really help me to understand the exercise more better

1 Like

This topic was automatically closed 41 days after the last reply. New replies are no longer allowed.