Home  >  Article  >  Web Front-end  >  In-depth understanding of css styles beyond hiding summary

In-depth understanding of css styles beyond hiding summary

高洛峰
高洛峰Original
2017-03-15 11:12:141409browse

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

1. Hide a single line of

html code

50e14a8282c7c1a3c636d5a8554946eb当文字超过范围的时候,超出部分会隐藏起来。94b3e26ee717c64999d7867364b1b4a3

css code

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

Result

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

2. Multi-line hiding

html code

50e14a8282c7c1a3c636d5a8554946eb当文字超过范围的时候,超出部分会隐藏起来。可以设置第几行开始隐藏。94b3e26ee717c64999d7867364b1b4a3

css code

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

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!

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