This is a piece of text content that requires multi-line ellipsis processing ```2. Next, set the style of the text container in CSS, including width, font size, line height and other attributes: ```."/> This is a piece of text content that requires multi-line ellipsis processing ```2. Next, set the style of the text container in CSS, including width, font size, line height and other attributes: ```.">
Home > Article > Web Front-end > How to display excess parts of multiple lines as ellipses in css
When multiple lines of text appear in CSS, there is often a problem that the excess part cannot be displayed normally. At this time we can use ellipses to solve this problem.
The specific operation method is as follows:
<div class="text-container"> 这是一段需要进行多行省略号处理的文本内容 </div>
.text-container { width: 300px; font-size: 16px; line-height: 1.5; }
.text-container { white-space: normal; overflow: hidden; text-overflow: ellipsis; display: -webkit-box; -webkit-line-clamp: 3; /* 控制行数 */ -webkit-box-orient: vertical; }
This completes the effect of CSS multi-line ellipsis. In general, the important thing to note is to set the width of the text container, and set the appropriate number of lines and ellipses style. At the same time, use the text-overflow attribute to control the ellipsis style of the excess part of the text to achieve better results.
The above is the detailed content of How to display excess parts of multiple lines as ellipses in css. For more information, please follow other related articles on the PHP Chinese website!