In-depth understanding of css styles beyond hiding summary

高洛峰
Release: 2017-03-15 11:12:14
Original
1356 people have browsed it

The text is hidden beyond the part, summarizing two methods.

1. Hide a single line of

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

Result

When the text exceeds the range, the excess part will be hidden.

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

result

When the text exceeds the range, the excess part will be hidden. You can set which row to start hiding.

The above is the detailed content of In-depth understanding of css styles beyond hiding summary. 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!