flex布局

flex布局不仅使用方便而且能大大缩短页面开发的时间,主要需要掌握2点,排列方向和对齐方式,下面进行详细介绍

1、水平排列 VS 垂直排列
row \ row-reverse \ column \ column-reverse

.flex-wrp{
    display: flex;
    flex-direction: row;//默认水平:row  垂直:column
}
.flex-item{
    width:300px;
}

<div class="flex-wrp">
    <div class="flex-item">1</div>
    <div class="flex-item">2</div>
    <div class="flex-item">3</div>
</div>复制代码


2、水平方向对齐 justify-content
flex-start \ flex-end \ center \ space-between \ space-around

.flex-wrp{
    display: flex;
    flex-direction: row;
    justify-content: center;
}复制代码


3、垂直方向对齐 align-items
stretch(子元素未设置高度时) \ flex-start \ flex-end \ center \ baseline 



转载于:https://juejin.im/post/5ceb5207e51d45778f076ca2

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值