How can I limit or clip text in SVG?

前端 未结 5 1596
傲寒
傲寒 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-07 00:07

    If you don't want to use a clip-path, which can be a pain if each element has a different size, then you can also use nested elements for clipping. Just make sure the svg elements have the CSS style overflow:hidden.

    
    
    
    
        Orange       
        Pear
        Banana   
        Pomegranate
    
        12
        7
        9
        2
    
        
    
    
    
    

提交回复
热议问题