【发布时间】:2018-10-27 15:37:39
【问题描述】:
代码:
<div id="over_flow">
<p>Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book. </p>
<p>It has survived not only five centuries, but also the leap into electronic typesetting, remaining essentially unchanged. It was popularised in the 1960s with the release of Letraset sheets containing Lorem Ipsum passages, and more recently with desktop publishing software like Aldus PageMaker including versions of Lorem Ipsum.</p>
</div>
css:
overflow: hidden;
text-overflow: ellipsis;
display: -webkit-box;
-webkit-line-clamp: 3;
-webkit-box-orient: vertical;
我有一个 div,其中我有两个具有动态内容的段落,它可能尽可能长。现在,我在这里做什么,我想在两三行之后用dots(...) 显示我的数据,但现在看起来不太好。那么,我该怎么做呢?请帮帮我。
谢谢
【问题讨论】:
-
你需要 JavaScript 来实现这一点
-
什么 javascript @JackBashford
-
这里有一个可以多行使用的插件codepen.io/sair/pen/KpbeKp
-
您可能会发现这个答案很有用:stackoverflow.com/questions/51967953/…