How to set default value to align content in CSS ?

CSS align-content property is used to distribute space between or around items in a flexbox or grid container. The default (initial) value of this property is normal, which behaves differently depending on the layout context.

Syntax

selector {
    align-content: value;
}

Possible Values

Value Description
normal Default value, behaves as stretch in flexbox
start Items pack from the start of the container
end Items pack from the end of the container
center Items pack in the center
space-between Equal space between items
space-around Equal space around items
space-evenly Equal space between and around items
stretch Items stretch to fill container

Example: Default Align Content (Normal)

The following example demonstrates the default align-content: normal behavior in a flexbox container

<!DOCTYPE html>
<html>
<head>
<style>
    .container {
        width: 300px;
        height: 200px;
        border: 2px solid #333;
        display: flex;
        flex-wrap: wrap;
        align-content: normal;
        background-color: #f0f0f0;
    }
    .item {
        width: 100px;
        height: 50px;
        margin: 5px;
        background-color: #4CAF50;
        color: white;
        display: flex;
        align-items: center;
        justify-content: center;
    }
</style>
</head>
<body>
    <h3>Default align-content (normal)</h3>
    <div class="container">
        <div class="item">1</div>
        <div class="item">2</div>
        <div class="item">3</div>
    </div>
</body>
</html>
A gray container with three green boxes numbered 1, 2, 3. Items are distributed naturally without extra spacing, starting from the top of the container.

Example: Comparing Different Values

The following example compares normal with other common values

<!DOCTYPE html>
<html>
<head>
<style>
    .container {
        width: 200px;
        height: 150px;
        border: 2px solid #333;
        display: flex;
        flex-wrap: wrap;
        margin: 10px;
        background-color: #f9f9f9;
    }
    .item {
        width: 80px;
        height: 30px;
        background-color: #2196F3;
        color: white;
        display: flex;
        align-items: center;
        justify-content: center;
        margin: 2px;
    }
    .normal { align-content: normal; }
    .center { align-content: center; }
    .space-between { align-content: space-between; }
</style>
</head>
<body>
    <h3>Normal (default)</h3>
    <div class="container normal">
        <div class="item">A</div>
        <div class="item">B</div>
        <div class="item">C</div>
    </div>
    
    <h3>Center</h3>
    <div class="container center">
        <div class="item">A</div>
        <div class="item">B</div>
        <div class="item">C</div>
    </div>
    
    <h3>Space Between</h3>
    <div class="container space-between">
        <div class="item">A</div>
        <div class="item">B</div>
        <div class="item">C</div>
    </div>
</body>
</html>
Three containers showing different align-content behaviors:
1. Normal: Items start from top naturally
2. Center: Items grouped in the center vertically
3. Space Between: Items spread with equal space between rows

Conclusion

The align-content property's default value normal provides natural content distribution. In flexbox containers, it behaves like stretch, making it ideal for flexible layouts without manual spacing adjustments.

Updated on: 2026-03-15T16:11:23+05:30

527 Views

Kickstart Your Career

Get certified by completing the course

Get Started
Advertisements