我可以在没有任何内容的SVG路径中添加逗号吗?

时间:2017-07-18 19:41:23

标签: svg

我已经在路径的d属性中看到了带逗号的SVG,其他的则有。 我提供的示例是不同的SVG,我只是将它们用作示例。

<svg fill="#6396b1" height="24" viewBox="0 0 24 24" width="24" xmlns="http://www.w3.org/2000/svg">
    <path d="M20 2H4c-1.1 0-1.99.9-1.99 2L2 22l4-4h14c1.1 0 2-.9 2-2V4c0-1.1-.9-2-2-2zM6 9h12v2H6V9zm8 5H6v-2h8v2zm4-6H6V6h12v2z"/>
    <path d="M0 0h24v24H0z" fill="none"/>
</svg>

我可以将上面的那个转换为:

<svg xmlns:x="http://ns.adobe.com/Extensibility/1.0/" xmlns:i="http://ns.adobe.com/AdobeIllustrator/10.0/" xmlns:graph="http://ns.adobe.com/Graphs/1.0/" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" version="1.1" id="Layer_1" x="0px" y="0px" viewBox="5.0 -10.0 100.0 135.0" enable-background="new 0 0 100 100" xml:space="preserve" height="100px" width="100px">
    <g i:extraneous="self">
        <g>
            <path fill="#132d48" d="M75.5,70.1c3-11.7,18.7-17.4,13.7-41.2C84.1,5.1,56.1,2.7,41.6,6.4c-15,3.9-27,19.9-23,33.2     c0.3,1,0.1,2.1-0.5,3c-1.8,2.8-6.8,9-8.1,12.6c-0.5,1.3,0.3,2.7,1.6,3.1c0.4,0.1,3,1.1,3.4,1.2c3.5,1.1,2.8,8.8,2.8,15.8     c0,7.3,7.8,6.3,10.3,5.8c2.6-0.6,8.3-1.1,8.3,5.9c0,0.9,0,1.7,0.1,2.3c0.1,1.4,1,2.6,2.3,3.1c5.1,2,20,5.1,38-1.4     c1.1-0.4,1.5-1.6,1-2.6C76.2,85.2,73.2,78.8,75.5,70.1z M67.9,21.1c3.6,0.5,6.1,3.8,5.5,7.4c-0.5,3.6-3.8,6.1-7.4,5.5     c-3.6-0.5-6.1-3.8-5.5-7.4C61,23.1,64.3,20.6,67.9,21.1z M54.5,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c0.7-1.8,2.8-2.7,4.6-2C49.2,42.7,50.1,44.8,49.4,46.6z"/>
        </g>
    </g>
</svg>

1 个答案:

答案 0 :(得分:0)

您可以在任意两个数字之间添加最多一个逗号。其他地方不允许使用逗号,因此例如M,3,3无效。您可以使用该逗号替换分隔不同数字所需的空格。