admin管理员组

文章数量:1312849

i have tried some basic examples like text, rect, circle, everything went fine. i just moved to Path element. I struggle to view the path in the browser. This is the code snippet i used

<svg width="500" height="200">
    <path d="M 20 35 L 120 100 Z"> </path>
</svg>

but seems its not working. i have tested chrome and firefox. can someone figure it out in correct way. Thanks in advance. also i just created a fiddle here

i have tried some basic examples like text, rect, circle, everything went fine. i just moved to Path element. I struggle to view the path in the browser. This is the code snippet i used

<svg width="500" height="200">
    <path d="M 20 35 L 120 100 Z"> </path>
</svg>

but seems its not working. i have tested chrome and firefox. can someone figure it out in correct way. Thanks in advance. also i just created a fiddle here

Share Improve this question asked Sep 8, 2016 at 20:37 subashsubash 3,1153 gold badges19 silver badges22 bronze badges 1
  • The initial value of stroke is none, which means no paint is applied unless you specify a color in some way. – traktor Commented Sep 8, 2016 at 22:32
Add a ment  | 

1 Answer 1

Reset to default 6

Try to add stroke and stroke-width attributes for showing the path:

    <svg width="500" height="200">
        <path stroke="#f00" stroke-width="3" d="M 20 35 L 120 100 Z"> </path>
    </svg>

Or add the third point like this:

    <svg width="500" height="200">
        <text y="20">SVG Test</text>
        <path d="M 20 35 L 120 100 L 0 100 Z"> </path>
    </svg>

本文标签: javascriptSimple SVG Path not workingStack Overflow