When the text exceeds the range, the excess part will be hidden. css code.mi { width: 200px; overflow: hidden; text-overflow: ellipsis; white-space:nowrap;} 2. Multi-line hidden html code
Home > Article > Web Front-end > Two ways to hide excess text content
Hide the text beyond the part, summarize two methods.
1. Single line hiding
html code
<p class="mi">当文字超过范围的时候,超出部分会隐藏起来。</p>
css code
.mi { width: 200px; overflow: hidden; text-overflow: ellipsis; white-space:nowrap; }
2. Multi-line hiding
html code
<p class="mi">当文字超过范围的时候,超出部分会隐藏起来。可以设置第几行开始隐藏。</p>
css code
.mi { width: 200px; overflow: hidden; display: -webkit-box; -webkit-box-orient:vertical; -webkit-line-clamp:2; }
The above is the detailed content of Two ways to hide excess text content. For more information, please follow other related articles on the PHP Chinese website!