2013-05-04 15 views
1

我有這樣一個div - :如何換行,直到允許的高度,然後再顯示省略號如果文本溢出最後一行 - CSS

<div id="prep">Hey jony whats up. The new solar radars are of great use and may evern put some of the wacky scientist to brain strom. Crazy!</div>. 

這是相關聯的CSS - :

#prep { 
    height:32px; 
    font-weight:bold; 
    overflow:hidden; 
    text-overflow:ellipsis; 
    font-family: Arial, Helvetica, sans-serif; 
    font-size:13px; 
    line-height:16px; 
    display:block; 
} 

顯然只有2行文字可見。但由於所有文本都不適合div,因此我想在最後一行可見文本行末尾顯示ellipses

回答

0
You need to add a width, and white space. 

    width: 56px; 
    white-space: nowrap; 
相關問題