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

Grid Align


CSS Grid Container - Align Grid Content

Inside the grid container you can define the alignment of the grid content with the following properties:

  • justify-content - Aligns the grid content when it does not use all available space on the main-axis (horizontally)
  • align-content - Aligns the grid content when it does not use all available space on the cross-axis (vertically)
  • place-content - Shorthand property for align-content and justify-content

The CSS justify-content Property

The justify-content property is used to align the grid content when it does not use all available space on the main-axis (horizontally).

This property can have one of the following values:

  • space-evenly
  • space-around
  • space-between
  • center
  • start
  • end

Note: The grid content's total width has to be less than the container's width for the justify-content property to have any effect.

Example

  .container {

    display: grid;

  justify-content: space-evenly;
}

Example

  .container {

    display: grid;

  justify-content: space-around;
}

Example

  .container {

    display: grid;

  justify-content: space-between;
}

Example

  .container {

    display: grid;

  justify-content: center;
}

Example

  .container {

    display: grid;

  justify-content: start;
}

Example

  .container {

    display: grid;

  justify-content: end;
}

The CSS align-content Property

The align-content property is used to align the grid content when it does not use all available space on the cross-axis (vertically).

This property can have one of the following values:

  • space-evenly
  • space-around
  • space-between
  • center
  • start
  • end

Note: The grid content's total height has to be less than the container's height for the align-content property to have any effect.

In the following examples we use a 300 pixels high container, to better demonstrate the align-content property.

Example

  .container {

    display: grid;
  height: 300px;

  align-content: center;
}

Example

  .container {

    display: grid;
  height: 300px;

  align-content: space-evenly;
}

Example

  .container {

    display: grid;
  height: 300px;

  align-content: space-around;
}

Example

  .container {

    display: grid;
  height: 300px;

  align-content: space-between;
}

Example

  .container {

    display: grid;
  height: 300px;

  align-content: start;
}

Example

  .container {

    display: grid;
  height: 300px;

  align-content: end;
}

The CSS place-content Property

The place-content property is a shorthand property for the align-content and the justify-content properties.

If place-content has two values:

  • place-content: start center; - the align-content value is 'start' and justify-content value is 'center'

If place-content has one value:

  • place-content: end; - both align-content and justify-content values are 'end'

Note: The grid item's total height and width has to be less than the container's height and width for the place-content property to have any effect.

Example

  .container {

    display: grid;
  height: 300px;

  place-content: center;
}

Example

  .container {

    display: grid;
  height: 300px;

  place-content: end space-between;
}

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

Grid Align – FAQs

Quick answers about learning Grid Align in CSS.

This free note from CodingNow 2.0 explains Grid Align 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 Grid Align, is 100% free with no signup required.
With focused practice, most students grasp Grid Align 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