In the writing of the page, often encountered some places of text display 1 lines, the extra text hidden, so that 1 lines of good control: The CSS code is as follows:
- White-space: nowrap;
- Overflow: hidden;
- text-overflow:ellipsis;
3 lines of code are done, this is common. But if 2 lines of text display superfluous hidden, i previously searched the internet a lot of said what with JS to control, with PHP control ... And so on, why not use CSS to control the same complex methods? Later found the answer, with CSS can also be used to control 2 lines of text display extra hidden.
- text-overflow:-o-ellipsis-lastline;
- Overflow: hidden;
- text-overflow:ellipsis;
- Display:-webkit-box;
- -webkit-line-clamp: 2;
- -webkit-box-orient:vertical;
More convenient is to change the value of Webkit-line-clamp can also achieve 3, 4, 5 and so on multi-line text display extra hidden effect ~ Source: 51799086
Pure CSS Control text 2 lines show extra parts hidden