Home > Web Front-end > CSS Tutorial > How Can I Create Multi-Line Ellipsis in CSS?

How Can I Create Multi-Line Ellipsis in CSS?

Linda Hamilton
Release: 2024-12-18 06:42:19
Original
774 people have browsed it

How Can I Create Multi-Line Ellipsis in CSS?

Using CSS for Multi-Line Ellipsis in Overflowed Blocks

The given CSS properties overflow: hidden; text-overflow: ellipsis; white-space: nowrap; are commonly used to truncate text in a single-line container. However, what if you need to apply the ellipsis to multiple lines of overflowing text?

Desired Outcome:

The goal is to obtain a multi-line text container with ellipsis (...). For instance, consider the following example:

+--------------------+
|abcde feg hij   dkjd|
|dsji jdia js ajid  s|
|jdis ajid dheu d ...| /* Here it's overflowed, so "..." is shown. */
+--------------------+
Copy after login

Current Limitations:

Unfortunately, the CSS properties mentioned above only apply to one-line elements. To achieve the desired multi-line functionality, external solutions are necessary.

jQuery Plugins for Multi-Line Ellipsis

Several jQuery plugins are available that specifically handle this issue:

  • http://pvdspek.github.com/jquery.autoellipsis/
  • http://dotdotdot.frebsite.nl/
  • http://keith-wood.name/more.html
  • http://github.com/tbasse/jquery-truncate

These plugins provide various options for customizing the ellipsis behavior, such as line breaking and fading effects.

Performance Considerations:

It is important to note that performance may vary among these plugins. To determine the most suitable solution, consider factors such as the number of lines, the performance of your browser, and the desired effects.

The above is the detailed content of How Can I Create Multi-Line Ellipsis in CSS?. For more information, please follow other related articles on the PHP Chinese website!

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
Latest Articles by Author
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template