FAQ: CSS Grid Essentials - Grid Column

This community-built FAQ covers the “Grid Column” 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 Column

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!

why do we use .b to set class=“box b” not .box b

2 Likes

A space in the class attribute means that each word is a seperate class.

Therefore, the element with class box b has both the box class and the b class, not a single class named box b.

Therefore, with .b, it is saying to apply the style to all elements with the b class. If you were to apply to elements matching .box b, it would apply to all bold text (<b> inside elements with the box class.

If you wanted to match an element with both the box and b classes, you would do: .box.b.

I hope that makes sense!

4 Likes

Instruction #3

“Let’s also make box b take up a few rows. Use grid-row with span to make the item take up rows two through four.”

Answer: grid-row: 2 / span 3;

Why is the “span 3” and not “span 4”?

It confuses me because it ask’s to take up rows two through FOUR.

1 Like

Because span 3 will make it span 3 rows, so starting with row 2, count: Row2, Row3, Row4.

If we used span 4, it will make it go one farther then we want, to row 5.

3 Likes

If anyone is having a hard time conceptualizing this, I recommend using graph paper and drawing out the same dimensions as the grid in the exercise.

I am sorry, I am confused. Please help
Instruction 2

Let’s make box b take up six columns. In style.css , create a rule for elements of class b . Use grid-column to set its starting column to 2 . Use span to make the item take up six columns.

Answer : Grid-column 2 / span 6

My understanding :- we starting from column 2 …I l start counting from column 2 + 3 + 4 + 5 + 6… so total 5 columns

Why is it “span 6” and not “span 5 ” ?

I think it’s because they are asking for you to create an item that covers 6 columns, not 5. From what I understand, “span #” refers to the number of rows/columns spanned across. What you interpreted was probably that the item covers up to column 6, which isn’t the same as spanning 6 columns. If we were to rewrite the code without using span, the code should say:
grid-column: 2 / 8;
In this case, the item will start at column 2 and end in column 7, just right before column 8 starts. This item will span 6 columns. Hope this helps!