Wrap a text within only two lines inside div

前端 未结 11 794

I want to wrap a text within only two lines inside div of specific width. If text goes beyond the length of two lines then I want to show elipses. Is there a way to do that

11条回答
  •  时光说笑
    2020-12-04 09:35

    CSS only

        line-height: 1.5;
        white-space: normal;
        overflow: hidden;
        text-overflow: ellipsis;
        display: -webkit-box;
        -webkit-line-clamp: 2;
        -webkit-box-orient: vertical;
    

提交回复
热议问题