li-you

1.文字在一行之内:

容器设置如下css样式

    overflow: hidden;
    white-space: nowrap;
    text-overflow: ellipsis;

2.文字在两行之内:

容器设置如下css样式

text-overflow:ellipsis;
display:-webkit-box; 
/* autoprefixer: off */
-webkit-box-orient:vertical;
/* autoprefixer: on */
-webkit-line-clamp:2; 

这里要注意,容器不能设置高度,并且,webpack不能编译-webkit-box-orient: vertical;这个属性,解决方法如上述代码。参考文档

 

分类:

技术点:

相关文章:

  • 2021-12-12
  • 2022-02-20
  • 2021-08-06
  • 2021-11-03
  • 2022-12-23
  • 2021-11-11
猜你喜欢
  • 2022-12-23
  • 2021-10-02
  • 2021-06-30
  • 2022-12-23
  • 2021-11-23
  • 2022-12-23
  • 2021-12-15
相关资源
相似解决方案