我正在寻找一种方法将<p>
标记截断为给定数量的行(尾随...
)。
使用多个字符不起作用,因为元素的宽度取决于设备屏幕宽度。
答案 0 :(得分:-2)
You don't need angular. Just CSS. Set a height and a text-overflow property.
something like this:
p{
height: 200px;
text-overflow: ellipsis;
}
You'll have to figure out the number of pixels that corresponds with the number of lines you want. For example, if you want 10 lines to show, and each line has a height of 20px, the height will need to be 200px.