English 中文(简体)
Flexbox - Align Content
  • 时间:2024-12-22

Flexbox - Apgn Content


Previous Page Next Page  

In case the flex-container has multiple pnes (when, flex-wrap: wrap), the apgn-content property defines the apgnment of each pne within the container.

Usage

apgn-content: flex-start | flex-end | center | space-between | space-around | stretch;

This property accepts the following values −

    stretch − The pnes in the content will stretch to fill up the remaining space.

    flex-start − All the pnes in the content are packed at the start of the container.

    flex-end − All the pnes in the content are packed at the end of the container.

    center − All the pnes in the content are packed at the center of the container.

    space-between − The extra space is distributed between the pnes evenly.

    space-around − The extra space is distributed between the pnes evenly with equal space around each pne (including the first and last pnes)

center

On passing this value to the property apgn-content, all the pnes are packed at the center of the container.

Flex Apgn Content - Center

The following example demonstrates the result of passing the value center to the apgn-content property.

<!doctype html>
<html lang = "en">
   <style>
      .box1{background:green;}
      .box2{background:blue;}
      .box3{background:red;}
      .box4{background:magenta;}
      .box5{background:yellow;}
      .box6{background:pink;}
      
      .box{
         font-size:25px;
         padding:15px;
         width:43%;
      }
      .container{
         display:flex;
         height:100vh;
         flex-wrap:wrap;
         apgn-content:center;
      }
   </style>
   
   <body>
      <span class = "container">
         <span class = "box box1">One</span>
         <span class = "box box2">two</span>
         <span class = "box box3">three</span>
         <span class = "box box4">four</span>
         <span class = "box box5">five</span>
         <span class = "box box6">six</span>
      </span>
   </body>
</html>

It will produce the following result −