文字换行和不换行:
white-space:breakall
white-space:nowrap

1,单行超出的文字呈省略号

    div{
      border:1px solid red;
      white-space:nowrap;
      overflow:hidden;
      text-overflow:ellipsis;
    }

多出的文字成省略号...

2.多行超出的文字呈省略号

 .line-clamp {
       border:1px solid red;
      display: -webkit-box;
      -webkit-line-clamp: 3;
      -webkit-box-orient: vertical; 
}
<p class="line-clamp">Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas. Vestibulum tortor quam, feugiat vitae, ultricies eget, tempor sit amet, ante. Donec eu libero sit amet quam egestas semper. Aenean ultricies mi vitae est. Mauris placerat eleifend leo.</p>

多出的文字成省略号...

多出的文字成省略号...

 

相关文章:

  • 2022-12-23
  • 2021-12-23
  • 2021-06-30
  • 2021-12-11
  • 2021-12-12
  • 2022-01-07
  • 2021-10-18
  • 2021-09-25
猜你喜欢
  • 2022-12-23
  • 2021-12-12
  • 2022-12-23
  • 2021-08-30
  • 2022-12-23
  • 2022-12-23
  • 2021-12-23
相关资源
相似解决方案