Greetings. I completed the Photo Gallery project here, it was about learning flexbox. Then I decided to do a small project on the side to check if I understand flexbox and all the properties and value within CSS flexbox. I came across a problem with align-items when I wanted to center the flex-items. It doesn’t work. Things like justofy-content do work as I am able to see the changes. I read an article here on freecodecamp and I tried to apply myself
I there’s something I need to be aware of, please let me know. Below is my code:
when you don’t specify a flex-direction, items are laid out left to right (on the main axis) by default and justify-content is used for that horizontal alignment. align-items would then apply to the vertical alignment of the items.
Try making your items on the main axis different heights: remove height from the .parent div selector and set different heights inside the .child selectors.
Then you will see what align-items is doing.
If you want to center all the items on the page, try adding: