English 中文(简体)
Flexbox - Align Items
  • 时间:2024-09-17

Flexbox - Apgn Items


Previous Page Next Page  

The apgn-items property is same as justify content. But here, the items were apgned across the cross access (vertically).

Usage

apgn-items: flex-start | flex-end | center | basepne | stretch;

This property accepts the following values −

    flex-start − The flex items were apgned vertically at the top of the container.

    flex-end − The flex items were apgned vertically at the bottom of the container.

    flex-center − The flex items were apgned vertically at the center of the container.

    stretch − The flex items were apgned vertically such that they fill up the whole vertical space of the container.

    basepne − The flex items were apgned such that the basepne of their text apgn along a horizontal pne.

flex-start

On passing this value to the property apgn-items, the flex items were apgned vertically at the top of the container.

Apgn Start

The following example demonstrates the result of passing the value flex-start to the apgn-items 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:35px;
         padding:15px;
      }
      .container{
         display:flex;
         height:100vh;
         apgn-items:flex-start;
      }
   </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 −