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 () 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 () below!
Agree with a comment or answer? Like () to up-vote the contribution!
In this exercise when we use the property grid-auto-flow: column; this property reorganize container to fit in the remain space.
The first and second column has a margin on the left and right side that you can see only using inspection.
But the third one that was fit on the right side don’t has this margin.
How to solve this issue?
When I use grid-auto-flow: column; , not just the newly added extra elements filled the columns from top to bottom, but all the contents did.
So it works on not just implicit elements?
In the right-most window (browser view) of the exercise, there is a pair of diagonal arrows. You can click them to switch between full and condensed views of the browser window.
As @propokeruk mentioned, if you use grid-auto-flow: row; which is the default, you will see the two new duplicate recipes (sweet churros and berry parfait) appear at the bottom of the rows.
Thank-you for replying, the screenshots of how it should look are very helpful! I did try to expand the window as you suggested during the lesson and there was no change. I reset my code, did it again, expanded all windows - I tried it all, i think, and it was still coming up squished together at the bottom of the 2nd column. Now I know what to expect though, so thank-you for taking the time
Not entirely sure I understand the question. Perhaps you will elaborate if I am misunderstanding the issue.
In index.html, we have the <main> tag. Within the <main> tag, we have a series of child divs. Each of these divs has the class “recipe” and also another class which is unique for each div e.g. <div class="recipe a"> and <div class="recipe b"> etc.
In style.css, we have set some rules for the <main> tag which specify how we want the children of the main tag to be displayed in a grid.
Additionally in style.css, we also have rules for img, h2, .time, .recipe, .mins, .description which help us further customize how the elements within each div are to be positioned.
In the exercise, I didn’t include grid-auto-column in the code and the grid-template (grid-template-columns: 250px 250px;) is set so that the grid only has two columns. So why did grid-auto-flow: column added a new column when the template says there should only be two?
Oh… I get it now. So basically, the template of two 250px columns are what is called explicit while the ones added by the auto-flow is implicit. That’s why they don’t actually contradict each other.
“grid-template-column” sets explicit columns
while
“grid-auto-flow: column” adds implicit columns
In your top screenshot, you are missing a rule within the the main selector of your style.css file. Perhaps, you need to reset the exercise for the rule to reappear (it appears for me just fine, perhaps it was accidentally deleted in your file.).
Alternatively, you can add the rule yourself.
The relevant rule to be added within the main selector is justify-content: center;
That should fix the problem you are seeing. If you omit/delete this rule, then the justify-content property takes on the default value of “normal” which can result in behaviour similar to your screenshot.
Hi, I would like to ask if I understood it correctly.
When we use grid-auto-flow: column; , does it mean that when there is an extra element, the page will create another column for the extra element? and also the column created will be the same size as the column that we key in?
Say that the code is this:
main {
grid-template-columns: 250px 250px;
grid-auto-flow: column;
}
when it creates a third new column it will create one with 250px as well? thank you