css limit text single line or multi line display beyond the implementation method of omitting

Css code that restricts the display of single lines of text:

overflow: hidden; // The property specifies that what happens when the content overflows the element box is hidden outside the area.
white-space: nowrap; // The property sets how to deal with the blank inside the element.nowrap The text in the paragraph is not wrapped.
text-overflow: ellipsis ; // The property specifies what happens when the text overflow contains elements. ellipsis displays ellipses to represent the trimmed text.

Css code that restricts the display of multiple lines of text:

overflow: hidden;
display: -webkit-box;
-webkit-box-orient: vertical;
-webkit-line-clamp: 2; // Number of lines to display

29 original articles published · Liked 40 · Visits 30,000+

Guess you like

Origin blog.csdn.net/xiyunmengyuan/article/details/102578906