背景,做一个前面图片宽度固定,后面宽度自适应,使用到了flex布局,但是想让后面div里文字不换行,超出以点点表示时,这时布局就乱了,查了下,原来flex布局与white-space:nowrap有影响

解决办法,父div设置min-width:0即可

 <div style="width:100%;display:flex;height:80px"><div style="width:50px"><img src="~/Content/Img/2.png" style="height:50px;" /></div><div style="flex:1;min-width:0">
                <div style="width:100%;height:40px;text-align:left;font-size:16px">
                    *******
                </div>
                <div style="width:100%;height:40px;text-align:left;font-size:14px;padding-left:20px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis">
                 *********
                </div>
            </div>
            <div class="clearfix"></div>
        </div>

 

相关文章:

  • 2022-12-23
  • 2021-10-28
  • 2022-02-28
  • 2021-04-15
  • 2021-10-26
  • 2021-05-28
  • 2021-12-13
  • 2021-10-26
猜你喜欢
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-11-17
  • 2022-01-27
相关资源
相似解决方案