🔥Limited Offer: Get 50% OFFon AI & Full Stack Courses🔥
Back to CSS Notes
Topic #174

Flexbox Align Items


CSS align-items Property

The align-items property aligns the flex items vertically (on the cross-axis).

This property can have one of the following values:

  • normal (default)
  • stretch
  • center
  • flex-start
  • flex-end
  • baseline

Example

  .flex-container {

  display: flex;
  height: 200px;

  align-items: center;
}

Example

  .flex-container {

  display: flex;
  height: 200px;

  align-items: flex-start;
}

Example

  .flex-container {

  display: flex;
  height: 200px;

  align-items: flex-end;
}

Example

  .flex-container {

  display: flex;
  height: 200px;

  align-items: stretch;
}

CSS align-content Property

The align-content property aligns the flex lines. It only has effect when flex items wrap onto multiple lines.

This property can have one of the following values:

  • stretch (default)
  • center
  • flex-start
  • flex-end
  • space-between
  • space-around
  • space-evenly

Example

  .flex-container {

  display: flex;
  height: 400px;

  flex-wrap: wrap;

  align-content: center;

}

Example

  .flex-container {

  display: flex;
  height: 400px;

  flex-wrap: wrap;

  align-content: space-between;

}

True Centering With Flexbox

The following example shows how to solve a common style problem: true centering.

To achieve true centering, set both the justify-content and the align-items properties to center for the flex container, and the flex item will be perfectly centered both horizontally and vertically:

Example

  .flex-container {
  display: flex;
  height: 400px;
  justify-content:
  center;
  align-items: center;
}

Want to go beyond the notes?

Join CodingNow 2.0's CSS course — live mentorship, real projects, and 100% placement support.

Enroll Now — Free Demo Available

Flexbox Align Items – FAQs

Quick answers about learning Flexbox Align Items in CSS.

This free note from CodingNow 2.0 explains Flexbox Align Items in CSS — concept, syntax and worked code examples you can copy, run and revise before interviews.
Yes. Every CSS topic on CodingNow 2.0, including Flexbox Align Items, is 100% free with no signup required.
With focused practice, most students grasp Flexbox Align Items in 1–3 days from these notes; pairing it with CodingNow 2.0's mentor-led course takes you to job-ready depth faster.
Use the code examples in this note, then ask doubts for free on the CodingNow 2.0 Community (/community) — expert instructors answer within 24 hours.
WhatsApp
Call NowEnroll Now