Add three dots in a multiline span

后端 未结 3 1907
终归单人心
终归单人心 2020-12-29 23:47

I found this question here on SO and the solution is pretty simple:

jsfiddle: http://jsfiddle.net/Y5vpb/

html:

Lorem Ipsum is s         


        
3条回答
  •  南笙
    南笙 (楼主)
    2020-12-30 00:08

    span{
        display: block; /* Fallback for non-webkit */
        display: -webkit-box;
        -webkit-line-clamp: 3; /* no of lines */
        text-overflow: ellipsis;
        overflow:hidden !important;
        width:180px;
    }
    

    above CSS property 'll put three dots...
    eg:

    Lorem Ipsum is simply dummy
    text of the printing and
    typesetting industry. Lorem...

提交回复
热议问题