文本溢出问题:特定高度段落中的省略号

时间:2017-02-18 09:30:06

标签: html css

例如,我有一个具有特定高度的段落。我想要超过那个高度的所有东西变成椭圆(...),而不是像在图片中那样将句子切成两半: enter image description here

我尝试过使用 text-overflow:ellipses 但是没用。 请帮帮我这个。谢谢!

1 个答案:

答案 0 :(得分:0)

尝试此代码



div{display:block;width:300px;text-overflow:ellipsis;;overflow-y:scroll;max-height:200px;

  display: -webkit-box;
  -webkit-line-clamp: 7;
  -webkit-box-orient: vertical;
}

<div>this is text this is text this is textthis is text this is text this is text this is text this is text this is text this is text this is text this is text this is text this is text this is text this is text this is text this is text this is text this is text this is text this is text this is text this is text this is text this is text this is text this is text this is text this is text this is text</div>
&#13;
&#13;
&#13;