微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

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

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>

 

<iframe height="240" src="https://codesandBox.io/embed/flex-3-b765q?fontsize=14" style="width: 100%; height: 500px; border: 0; border-radius: 4px; overflow: hidden;" title="flex-3" width="320"></iframe>

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。

相关推荐