subash subash - 4 months ago 34
Javascript Question

Simple SVG Path not working

i have tried some basic examples like text, rect, circle, everything went fine. i just moved to

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>

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


It is simple!
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>

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>