Filling a simple SVG in a div

前端 未结 2 1157
别那么骄傲
别那么骄傲 2021-01-25 00:53

Here is my relevant HML with SVG:

2条回答
  •  不要未来只要你来
    2021-01-25 01:02

    I'm not very sure I understand your question. Maybe this is what you need:

    I've changed the viewBox to viewBox="0 3 24 18". In order to get this value I've console.log(thePath.getBBox())

    The method getBBox() returns an object with the position and the size of the bounding box of the path. I'm using this values for the new viewBox

    viewBox = bb.x bb.y bb.width bb.height

    Where bb is the bounding box.

提交回复
热议问题