Jump to content

polyline tag in SVG defs


PHPremote

Recommended Posts

Why does my polyline tag in SVG not accept style set inside defs tag but does in normal CSS?

Here is my code: 

<html>
<body>

<style>
 .trapezoid2 { fill:beige;stroke:forestgreen;stroke-width:2; }
</style>

<center> <!-- I routinely use the center tag for older browsers. -->

<svg height="400" width="800" style="border:5px double blue;background-color:tan;margin:0 auto;" >
  <defs>
        <polygon id="trapezoid1" style="fill:tan;stroke:blue;stroke-width:4;" />
  </defs>
    
     <use xlink:href="#trapezoid1" points="100,200 150,100 350,100 400,200" />
     
     <polygon id=".trapezoid2" points="400,300 450,200 650,200 700,300" style="fill:beige;stroke:forestgreen;stroke-width:2;" />
</svg>

</center>
</body>
</html>

The second trapezoid shows up but not the first.

Thanks,

PHPremote aka Patrick

 

 

w3forum_polyline_defJune3.html

Link to comment
Share on other sites

The <use> tag just includes the content exactly as it is in the <defs> element. You cannot put attributes on the <use> tag and expect them to be applied to the included elements.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...