2016-08-29 120 views
1

的jsfiddle代碼: https://jsfiddle.net/JaneChen/gu7tf864/1/文本溢出:省略號不起作用顯示行有限

<span class="fileName" >long name file to display long name file to displayddddddssdd moreggggg lines more lines more more more lines</span> 

.scss:

.fileName { 
    @font-size: 17px; 
    @line-height: 1.3; 
    @lines-to-show: 3; 

    -webkit-font-smoothing: antialiased; 
    -webkit-line-clamp: 3; 
    display: inline-block; 


    overflow:hidden; 
    display: -webkit-box; 


    text-overflow: ellipsis; 
    width: 175px; 


    font-size: 17px; 
    line-height: 1.4; 
    max-height: 71.4px; 
} 

文本塊顯示爲3行,但沒有按省略號當文本被截斷時不顯示。這是爲什麼 ?有沒有辦法解決?謝謝!

回答

1

您忘記

-webkit-box-orient: vertical; 
1

你忘了

white-space: nowrap; 

檢查結果 https://jsfiddle.net/gu7tf864/3/

+0

然後將文本塊只顯示在一行。有限的文本行是這個問題的基本條件。不過謝謝。 – Jane