How can I limit or clip text in SVG?

前端 未结 5 1690
傲寒
傲寒 2021-02-06 23:36

I have done a table in SVG, and I want to fill it with data dynamically. That means that I don\'t know how much space the text takes, and I want to clip or hide the overlapping

5条回答
  •  半阙折子戏
    2021-02-06 23:57

    (1) There is no reason to use SVG for tables. Use HTML tables.

    (2) By "clipping" I understand you to mean that the excess text will be obscured. SVG uses a "painter's model" whereby elements specified later in the document are drawn above elements specified earlier. This will allow you to clip regions.

    (3) If you really needed to do this in an SVG document you could use a foreign object, and embed HTML.

提交回复
热议问题