This community-built FAQ covers the “Justify Items” exercise from the lesson “Advanced CSS Grid”.
Paths and Courses
This exercise can be found in the following Codecademy content:
Learn CSS
FAQs on the exercise Justify Items
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!
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!
what is the difference between “justify-content” and "justify-item " commands?
1 Like
I set the width for .recipe to 200px, then I used the (justify-item:end) for .main but there wasn’t any change for the main?
1 Like
Add an ‘s’ to the end of ‘item’: justify-items: end;
1 Like
the difference is barely justify-items: end;
vs visible justify-items: center;
check out the image
5 Likes
I hope that I’m understanding this correctly in which I am not giving out misinformation.
First off, the class .recipe has a width of 200px. The grid-template-columns have width 250px. So “justify-item” shifts the “.recipe” left and right within the 250px columns.
Next, “justify-content” moves the entire column across the page along the row axis. It moves the entire 250px box instead of just the item within the column.
3 Likes
Is worthwhile to study Flexbox and Pseudo classes, elements, selector CSS?
They are not obsolete? If not what are some benefits?
1 Like
I’m still learning myself and although Flexbox and Grids are similar they do have their differences. It’s worth learning them all as you may need a slightly different tool as a solution to a problem…
2 Likes
The text states that "by setting the justify-items
property to center
, the .card
<div>
s will be centered inside of their columns. They will only be as wide as necessary to contain their content (the words Card 1, etc). "
It works on the code they provide in the explanation, and I assumed it would work on any code. However, it doesn’t on the one in the exercise: if I don’t specify the width of the .recipe div
s, they span the width of their columns even if I set justify-items
to center
in the main div
. Why is that?
1 Like
If you don’t specify the width for the .receipe divs, there’s no way you will be able to center it, or move it to the start or end of the column.
Note: The value of the width of the .receipe div as to be less than the value of the width for the column, so that you will be able to move them along the row axis of the column