flex 在html中显示不出来,html – 文本省略号不显示在flexbox项目上

对于文本溢出:要使用省略号,必须定义宽度.你有flex-basis:auto,这还不够.

此外,文本溢出:省略号仅适用于块级元素.

弹性项目被视为blockified,省略号将起作用.但是,您还将display:flex应用于flex项,这会破坏display属性的块级规则.

尝试这些调整:

ul {

display: flex;

height: 40px;

margin: 0;

padding: 0;

width: 100%;

list-style: none;

}

ul li {

/* display: flex;

/* align-items: center;

height: 100%;

padding: 0 4px;

border-bottom: 1px solid #eee;

}

ul li:first-child {

width: 55px;

flex-shrink: 0;

}

ul li:first-child input {

width: 100%;

}

ul li:last-child {

width: 48px;

flex-shrink: 0;

}

ul li:nth-child(2) {

flex: 0 1 100px; /* adjusted; 100px for demo only */

white-space: nowrap;

overflow: hidden;

text-overflow: ellipsis;

min-width: 0px;

}

ul li:nth-child(3) {

width: 75px;

flex-shrink: 0;

}

  • A very long text description goes here
  • $99.90
  • Del

要使文本垂直居中,可以像以前一样在非省略号元素上使用flex布局.要使省略号文本垂直居中,请点击try another method.

参考文献:

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

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值