【问题标题】:How to wrap text till the allowed height, and then show ellipses if text overflows at the last line - CSS [duplicate]如何将文本包装到允许的高度,然后如果文本在最后一行溢出,则显示省略号 - CSS [重复]
【发布时间】:2013-04-28 19:20:26
【问题描述】:

我有一个这样的 div -:

<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

【问题讨论】:

    标签: css


    【解决方案1】:
    You need to add a width, and white space.
    
        width: 56px;
        white-space: nowrap;
    

    【讨论】:

      猜你喜欢
      • 2012-04-13
      • 2015-09-06
      • 1970-01-01
      • 1970-01-01
      • 2014-07-18
      • 1970-01-01
      • 1970-01-01
      • 2019-01-19
      • 1970-01-01
      相关资源
      最近更新 更多