How to hide the excess part of text

php中世界最好的语言
Release: 2018-03-22 11:35:20
Original
2326 people have browsed it

This time I will show you how to hide the excess part of the text, what are the precautions for hiding the excess part of the text, the following is a practical case, let's take a look.

Hide the part beyond the text, summarize two methods.

1. Single line hiding

html code

<p class="mi">当文字超过范围的时候,超出部分会隐藏起来。</p>
Copy after login

css code

.mi {
    width: 200px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space:nowrap;
}
Copy after login

2. Multi-line hiding

html code

<p class="mi">当文字超过范围的时候,超出部分会隐藏起来。可以设置第几行开始隐藏。</p>
Copy after login

css code

.mi {
    width: 200px;
    overflow: hidden;
    display: -webkit-box;
    -webkit-box-orient:vertical;
    -webkit-line-clamp:2;
}
Copy after login

I believe you have mastered the method after reading the case in this article. For more exciting information, please pay attention to other related articles on the php Chinese website!

Recommended reading:

CSS to implement 3d translucent cube

Two methods to implement progress bar in CSS3

Several ways to implement Footer bottom placement in CSS

The above is the detailed content of How to hide the excess part of text. For more information, please follow other related articles on the PHP Chinese website!

Related labels:
source:php.cn
Statement of this Website
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
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!