Cross-browser multi-line text overflow with ellipsis appended within a fixed width and height

前端 未结 25 2846
栀梦
栀梦 2020-11-22 16:19

I made an image for this question to make it easier to understand.

Is it possible to create an ellipsis on a

with a fixed width and multiple
25条回答
  •  清歌不尽
    2020-11-22 16:27

    There is no such feature in HTML, and this is very frustrating.

    I have developed a library to deal with this.

    • Multiline text-overflow: ellipsis
    • Multiline text with technologies that does not support it: SVG, Canvas for example
    • Have exactly the same line breaks in your SVG text, in your HTML rendering, and in your PDF export for example

    Check out my site for screenshot, tutorial, and dowload link.

提交回复
热议问题