CSS Flexbox: align-items

Ayu is a tech blogger, open source contributor & maintainer, and tech community enthusiast based in the Netherlands. She loves photography and iced coffee!
Search for a command to run...

Ayu is a tech blogger, open source contributor & maintainer, and tech community enthusiast based in the Netherlands. She loves photography and iced coffee!
No comments yet. Be the first to comment.
This series is my log of what I learned about responsiveness in CSS
Hello Fellow Codenewbies 👋 So let's say we have finished styling our app. But on a certain size of the page view, we want to apply a different style to our app. This is the time where media queries come into play. Media Queries Media queries are ...
Hi friends 👋, I've been writing tech blog posts for a few years now. If you don't know me yet, English is my second language. My mother tongue is Indonesian, and I'm also surrounded by Dutch every da

I frequently receive messages from enthusiastic contributors who have completed 2 or 3 high-quality pull requests (PRs) in just 1 month. They’re proactive, their work is top-tier, and they’ve handled

A few months ago, I shared a story about building an automated open source portfolio using just my smartphone and an AI assistant while on vacation. My main goal was to stop the "spreadsheet struggle"

Recently, I read Bekah Hawrot Weigel’s blog post, "When 'Local' Went Global: The Pandemic Era of International Communities." As someone active in many online communities, I found it a bit sad, but I agree with her points and think they apply to open ...

Hacktoberfest is almost over. How has your contribution journey been so far? Are you confident about contributing to open source projects, or are you still struggling to find your way? If you're new to open source and still feel overwhelmed, that's c...

Hello Fellow Codenewbies 👋
By default, flex is stretching the height of the items based on the highest item.

But when we need to, we can control the vertical position (cross axis) of the items with align-items.
align-items property is good to be applied when we have an element that has background color/shadow/borders so we can see the effect.
align-itemsIt aligns the items on the top (start) of the flex container, and the height of each item is maintained as it is.
⭐ This value is used most often to control the vertical position of flex items.

It aligns the items vertically on the center of the flex container.

It aligns the items on the bottom (end) of the flex container.

This is the default value of align-items.
It stretches the height of the items based on the highest item.
Usually, it is used if we need to reset or override an applied value.

It aligns the items based on the first line of texts to be in line with each other.
This value is barely used and we only can see the effect when we have elements with text in them.

I provide here the Codepen for you to play around with.
align-items property works with cross axis (vertical position) and is used when we want or need to control the vertical position of flex items in a flex container.
The values of align-items that we need to know are: