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
When text"/> 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
When text">

Home  >  Article  >  Web Front-end  >  Two ways to hide excess text content

Two ways to hide excess text content

巴扎黑
巴扎黑Original
2017-03-14 10:20:352650browse

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!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn