FAQ: CSS Grid Essentials - Creating Rows

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

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!

Good day,

I tried to see what would happen if I did the unthinkable and made the total of grid-template-rows to be more than 100%, like so:

grid-template-rows 80% 40% 50px;

Apparently, it just expands the grid. Is there anything I should know about doing this or is it something I should just avoid in general?

2 Likes

I just tried this out, and from what I see it seems like what ever the % is describes what the height of the row would be in relation to the class width.

Such as if the class width is 400px and all three rows are 100% each row would be 400px in height. If I guess right the % & px on the grid-template-columns or grid-template-rows can be adjusted by adjusting there value off the class width. So 125% will give 500 px if the class width is 400px.

1 Like

Is there a way to determine how many rows I want my grid to have, aside from specifying it in “grid-template-rows”?

I think the grid-template-rows depend on 2 cases:

  1. The screen size of your website visitors (mobile, tablet, desktop etc…)
  2. The design spec sheet you receive from a web designer.

Here’s an example:
Lets say you have 3 rows and in the middle row you want to put an academic research paper that is +5000 words. If your website visitors are on a desktop, this is not an issue but if they are on their phone then they’ll be scrolling forever to finish the reading. Once they get to the bottom of the article, unless you have a scroll to the top button and/or put the article as an outside link for a download, users will be forced to back out of your page or worst case scenario, scroll forever to get back to the top of your website.

This may not be an issue for one academic article but if its repeated several times throughout your page then it can negatively impact users experience.

You could use auto for the row’s height or even limit the height to perhaps 500px. This could improve the overall visual of your page but they still have to scroll to read the whole article. I would say experiment to find what works best and collaborate with your UI, UX partners to find a happy medium.

Why is it not the other way round where rows are defined to be percentages of width and columns percentages of height, since rows are horizontal and columns are vertical.