Home >Web Front-end >CSS Tutorial >How to hide the excess text in css

How to hide the excess text in css

王林
王林Original
2020-11-18 17:22:302693browse

How to hide the excess part of text in css: You can use the text-overflow attribute, such as [text-overflow:ellipsis;]. The attribute value ellipsis indicates the use of ellipses to represent excess text.

How to hide the excess text in css

Attribute introduction:

The text-overflow attribute specifies what should happen when text overflows the element containing it.

(Learning video sharing: css video tutorial)

Grammar:

text-overflow: clip|ellipsis|string;

Attribute value:

  • clip Trim text.

  • ellipsis Displays ellipses to represent trimmed text.

  • #string Use the given string to represent the trimmed text.

Example:

The overflow of a single line of text displays an ellipsis

overflow: hidden;
text-overflow:ellipsis;
white-space: nowrap;

Related recommendations: CSS tutorial

The above is the detailed content of How to hide the excess text in css. 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