当前位置 : 主页 > 网页制作 > css >

[CSS] Change the off-axis Alignment of a Flexed Container with `align-items`

来源:互联网 收集:自由互联 发布时间:2021-06-13
We changed the axis layout with ‘justify-content‘, and the "off axis" layout is controlled by ‘align-items‘. The most common values are flex-start , flex-end , or center . body { display : flex ; flex-direction : row ;} .container {

We changed the axis layout with ‘justify-content‘, and the "off axis" layout is controlled by ‘align-items‘. The most common values are flex-startflex-end, or center.

body {
  display: flex;
  flex-direction: row;
}

.container {
  background-color: #ebb871;
  display: flex;
  flex-direction: column;
  justify-content: space-between;

  align-items: flex-start;
  align-items: flex-end;
  align-items: center
}
<body>
    <div class="container">
        <div class="box1 red"></div>
        <div class="box2 green"></div>
        <div class="box3 blue"></div>
    </div>
</body>
网友评论