---
title: "CSS grid align-content Property Tutorial"
url: https://weworkworldwide.com/tutorials/css-grid-align-content-property-tutorial/
description: "In this section, we will learn what the grid align-content property is and how to use it in CSS. Click here to run the example of grid align-content proper"
date: 2026-04-26T14:31:36+00:00
source: https://weworkworldwide.com/llms.txt
---

# CSS grid align-content Property Tutorial

In this section, we will learn what the grid align-content property is and how to use it in CSS.

Click here to run the example of grid align-content property.

## CSS grid align-content Property Definition and Usage

The grid that we build using CSS resides within an element that is technically the container of that grid.

If the size of the grid-container was vertically bigger than the grid itself, we can decide how we want the grid to be vertically positioned inside the grid-container using the CSS `align-content`.

## CSS grid align-content Property Syntax

``` line-numbers
align-content: value;
```

## CSS grid align-content Property Value

Here’s the list of values we can set for this property:

-   **start**: Using this value, the grid will be  
    positioned at the top edge of the container and push any free space to  
    the bottom edge of the container.

``` line-numbers
```

-   **end**: Using this value, the grid will be  
    positioned at the bottom edge of the container and push any free space  
    to the top edge of the container.

``` line-numbers
```

-   **center**: using this value, the grid will be  
    positioned at the center of the container and push any free space around  
    them (but not between them).

``` line-numbers
```

-   **stretch**: Using this value, the grid will stretch  
    its rows in order to fill any vertical free space of the  
    container.

``` line-numbers
```

-   **space-between**: Using this value, the first and  
    last column (horizontal track) of the grid will be positioned at the top  
    and bottom edge of the container and any free space will be pushed  
    between the rest of rows.

``` line-numbers
```

-   **space-around**: Using this value, any vertical  
    free space of the container will be evenly pushed around columns  
    (horizontal tracks) except that first and the last columns will take  
    half of the space that is pushed between each column.

``` line-numbers
```

-   **space-evenly**: Using this value, any vertical  
    free space of the container will be evenly pushed around columns  
    (horizontal tracks).

``` line-numbers
```

## Example: align center with CSS

``` line-numbers
<!DOCTYPE html>
<html>
<head>
<title>CSS is fun :)</title>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<style type="text/css">
*, ::after, ::before{
margin:unset;
box-sizing: border-box;
}
.grid{
display: grid;
grid-template-rows: repeat(2 , minmax(100px , auto));
grid-template-columns: repeat(3, 20vw);
grid-gap: 2px;
align-content:center;
height:90vh;
border:thin solid;
}
.item{
background-color: whitesmoke;
border:thin solid;
}
</style>
</head>
<body>

Item One
Item Two
Item Three
Item Four
Item Five 

</body>
</html>
```

## Example: grid align-content end

``` line-numbers
<!DOCTYPE html>
<html>
<head>
<title>CSS is fun :)</title>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<style type="text/css">
*, ::after, ::before{
margin:unset;
box-sizing: border-box;
}
.grid{
display: grid;
grid-template-rows: repeat(2 , minmax(100px , auto));
grid-template-columns: repeat(3, 20vw);
grid-gap: 2px;
align-content:end;
height:90vh;
border:thin solid;
}
.item{
background-color: whitesmoke;
border:thin solid;
}
</style>
</head>
<body>

Item One
Item Two
Item Three
Item Four
Item Five 

</body>
</html>
```
