在Flex布局中给文字设置超出部分隐藏

582 阅读1分钟

在弹性盒子中给文字设置超出部分隐藏

注意:

1.盒子要有宽度

2.或者父盒子要有宽度

3.如果盒子不想设置具体宽度可以设置flex:1;width:0

4.前提条件是父盒子要是flex

代码:

.orders.goods.txt{
flex:1;
width:0;

.orders .goods .txt h5{
    text-overflow: ellipsis;
    white-space: nowrap;
    overflow: hidden;
}