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

弹性盒布局

弹性盒子

<style>
    
    .zi{
        height:100px;
        width:100px;
        background:purple;
        margin:2px;
        line-height:100px;
        text-align: center;
        color:#fff;
    }
    .fu{
        height:400px;
        width:600px;
        margin:50px;
        background:pink;
        display:flex;
        flex-direction:row;
        flex-wrap:Nowrap;
        align-items:center;
        justify-content:space-around;
    }
</style>
<body>
    <div class="fu">
        <div class="zi">一</div>
        <div class="zi">二</div>
        <div class="zi">三</div>
        <div class="zi">四</div>
        <div class="zi">五</div>
    </div>
</body>
</html>
<script>
    flex:1;      //反正就是占满了,移动端适配的时候合适.
    
    
    flex-direction     row          row-reverse     column         column-reverse
    // 主轴方向           左向右          右向左         上向下         下向上
    
    flex-wrap          Nowrap       wrap           wrap-reverse
    // 换行不           不换         换            规定元素在必要的时候拆行或拆列,但是以相反的顺序
    
    align-items           center       flex-start      flex-end        baseline
    // 纵轴方向         中心         开头            下头             基线(没觉得有啥用)
    
    justify-content     flex-start   flex-end       center       space-between       space-around
    // 主轴方向对齐方式     开头       结尾           中心          两边贴边儿          两边不贴边儿
    
    align-content        //同上
    // 纵轴方向对齐方式
</script>

 

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

相关推荐