📜  html scale svg - Html 代码示例

📅  最后修改于: 2022-03-11 14:53:17.304000             🧑  作者: Mango

代码示例3
// Javascript to run after document load
var svg = document.getElementsByTagName("svg")[0];
var bbox = svg.getBBox();
svg.setAttribute("width", bbox.width + "px");
svg.setAttribute("height", bbox.height + "px");
svg.setAttribute("viewBox", `${bbox.x} ${bbox.y} ${bbox.width} ${bbox.height}`);