flex布局出现bug的解决方法

(1)使用flex-basis出现bug

 <style>
        .big{
            width: 400px;
            height: 100px;
            background-color: lightcoral;
            margin:0 auto;
            display:flex;
        }
        .left{
            flex-basis:100px;
            background-color: black;
        }
        .right{
            flex:1;
            /* 解决方法就是给该元素加上overflow:hidden; */
            overflow: hidden;
        }
        p{
            width: 100%;
            word-wrap: wrap;
            text-overflow: ellipsis;
            overflow: hidden;
        }

    </style>
     <div class="big">
        <div class="left"></div>
        <div class="right">
            <p>hello123hello12helloheloolhello3hello123hello123</p>
        </div>
    </div>

(2)flex-flow分配出现问题,当所有子元素都是flex-flow:1;当其中一个子元素内容很多时,没有等比例缩放,这个时候有两种解决方法:把flex-flow:1改为flex:1。另外一种解决方法是:flex-basis:%0;再flex-flow:1之后加上这句。


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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值