Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/html/75.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/svg/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Html 如何在另一个SVG标记中嵌入SVG标记?_Html_Svg - Fatal编程技术网

Html 如何在另一个SVG标记中嵌入SVG标记?

Html 如何在另一个SVG标记中嵌入SVG标记?,html,svg,Html,Svg,我想将一个SVG标记嵌入另一个SVG标记,如下所示: <svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" version="1.1" width="1000" height="1000" viewBox="0 0 1000 1000"> <

我想将一个SVG标记嵌入另一个SVG标记,如下所示:

<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" version="1.1" width="1000" height="1000" viewBox="0 0 1000 1000">
    <svg>
        <g stroke="black" stroke-width="2">
            <rect x="150" y="150" width="300" height="30"style="fill:black"/>
            <rect x="250" y="150" width="100" height="30" style="fill:white"/>
            <text x="250" y="140" font-size="40"text-anchor="middle">50</text>
        </g>
    </svg>

50
我想将矩形封装在它们自己的
中,以便更容易地控制它们,并将它们分组并放在父svg标记中。但这不起作用


有什么建议/解决方案吗?

您需要关闭外部
。除此之外,您的代码还可以工作。