Home > Web Front-end > CSS Tutorial > How to limit the number of characters in css

How to limit the number of characters in css

零到壹度
Release: 2018-03-23 10:02:54
Original
4114 people have browsed it

This article mainly shares with you how to limit the number of characters in CSS, mainly in the form of code. I hope it can help everyone.

html part

<!DOCTYPE html>
<html>
	<head>
		<meta charset="UTF-8">
		<title></title>
	</head>
	<body>
		<p id="nr">
			我是显示的内容
我是显示的内容
我是显示的内容
		</p>
	</body>
</html>
Copy after login

css part

width:20px;
overflow: hidden;
text-overflow: ellipsis;
//限制字数显示
white-space: nowrap;
//后面出来省略号
Copy after login

Related recommendations:

css limits the number of displayed words, and the excess text length is represented by ellipses

How to implement CSS limit number of words

html5 tag uses css to limit the number of displayed lines (number of words)

The above is the detailed content of How to limit the number of characters in css. 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