CSS Align

The CSS align-content property sets the distribution of space between and around content items along a flexbox’s cross-axis or a grid’s block axis.

Syntax:

align-content: stretch|center|flex-start|flex-end|space-between|space-around|initial|inherit;

Example:

<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>CSS align</title>
    <style>
        #main {
            width: 70px;
            height: 300px;
            border: 1px solid #cf9c9c;
            display: flex;
            flex-wrap: wrap;
            align-content: center;
        }

        #main div {
            width: 70px;
            height: 70px;
        }
    </style>
</head>
</head>

<body>
    <h1>The align-content Property</h1>

    <div id="main">
        <div style="background-color:rgb(156, 80, 255);"></div>
        <div style="background-color:rgb(208, 230, 173);"></div>
        <div style="background-color:rgb(241, 18, 55);"></div>
    </div>
</body>

</html>

Output:

Leave a Reply